1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
package org.openpermis.examples.xacml; |
9 | |
|
10 | |
import java.net.URI; |
11 | |
import java.util.List; |
12 | |
|
13 | |
import org.openpermis.AuthorizationService; |
14 | |
import org.openpermis.AuthorizationServiceException; |
15 | |
import org.openpermis.Subject; |
16 | |
import org.openpermis.policy.AccessDecision; |
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | 0 | public class DummyAuthorizationService implements AuthorizationService { |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
public AccessDecision getAccessDecision ( |
30 | |
URI subject, URI resource, String actionName, List<?> arguments |
31 | |
) |
32 | |
throws AuthorizationServiceException |
33 | |
{ |
34 | 0 | if ( |
35 | |
URI.create("S").equals(subject) && |
36 | |
URI.create("R").equals(resource) && |
37 | |
"A".equals(actionName) |
38 | |
) { |
39 | 0 | return new AccessDecision(true); |
40 | |
} |
41 | 0 | return new AccessDecision(false); |
42 | |
} |
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
public AccessDecision getAccessDecision ( |
48 | |
Subject subject, URI resource, String actionName, List<?> arguments |
49 | |
) |
50 | |
throws AuthorizationServiceException |
51 | |
{ |
52 | 0 | throw new IllegalStateException("Just a dummy authorization service."); |
53 | |
} |
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | |
public Subject retrieveSubject (URI identity) throws AuthorizationServiceException { |
59 | 0 | throw new IllegalStateException("Just a dummy authorization service."); |
60 | |
} |
61 | |
|
62 | |
|
63 | |
} |