Coverage Report - org.openpermis.examples.xacml.DummyAuthorizationService
 
Classes in this File Line Coverage Branch Coverage Complexity
DummyAuthorizationService
0%
0/6
0%
0/6
3
 
 1  
 /*
 2  
  * Copyright (c) 2009, Ergon Informatik AG (http://www.ergon.ch)
 3  
  * All rights reserved.
 4  
  * 
 5  
  * Licensed under the Open Permis License which accompanies this distribution, 
 6  
  * and is available at http://www.openpermis.org/BSDlicenceKent.txt
 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  
  * A simple dummy version of an authentication service that authorizes only a subject "S" to
 21  
  * execute action "A" on resource "R".
 22  
  * @since 0.4.0
 23  
  */
 24  0
 public class DummyAuthorizationService implements AuthorizationService {
 25  
 
 26  
         /**
 27  
          * @since 0.4.0
 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  
          * @since 0.4.0
 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  
          * @since 0.4.0
 57  
          */
 58  
         public Subject retrieveSubject (URI identity) throws AuthorizationServiceException {
 59  0
                 throw new IllegalStateException("Just a dummy authorization service.");
 60  
         }
 61  
 
 62  
 
 63  
 }