Package org.jboss.security.authorization.resources

Examples of org.jboss.security.authorization.resources.WebResource


      final HashMap map =  new HashMap();
      map.put("catalina.request",request);
      map.put("catalina.constraints",constraints);
      map.put("catalina.context", context);
      map.put("authorizationManager",authzManager);
      WebResource resource = new WebResource(map);
      try
      {
         int check = authzManager.authorize(resource);
         isAuthorized = (check == AuthorizationContext.PERMIT);
      }
View Full Code Here


      final HashMap map =  new HashMap();
      map.put("catalina.request",request);
      map.put("catalina.constraints",constraints);
      map.put("catalina.context", context);
      map.put("authorizationManager",authzManager);
      WebResource resource = new WebResource(map);
      try
      {
         int check = authzManager.authorize(resource);
         isAuthorized = (check == AuthorizationContext.PERMIT);
      }
View Full Code Here

   public int authorize(Resource resource, Subject callerSubject, RoleGroup role)
   {
      if(resource instanceof WebResource == false)
         throw new IllegalArgumentException("resource is not a WebResource");
     
      WebResource webResource = (WebResource) resource;
     
      //Get the context map
      Map<String,Object> map = resource.getMap();
      if(map == null)
         throw new IllegalStateException("Map from the Resource is null");
     
      //Get the Request Object
      request = (HttpServletRequest) webResource.getServletRequest();
     
      webCS = webResource.getCodeSource();
      this.canonicalRequestURI = webResource.getCanonicalRequestURI();     

      String roleName = (String)map.get(ResourceKeys.ROLENAME);
      Principal principal = (Principal)map.get(ResourceKeys.HASROLE_PRINCIPAL);
      Set<Principal> roles = (Set<Principal>)map.get(ResourceKeys.PRINCIPAL_ROLES);
      String servletName = webResource.getServletName();
      Boolean resourceCheck = checkBooleanValue((Boolean)map.get(ResourceKeys.RESOURCE_PERM_CHECK));
      Boolean userDataCheck = checkBooleanValue((Boolean)map.get(ResourceKeys.USERDATA_PERM_CHECK));
      Boolean roleRefCheck = checkBooleanValue((Boolean)map.get(ResourceKeys.ROLEREF_PERM_CHECK));
     
      validatePermissionChecks(resourceCheck,userDataCheck,roleRefCheck);
View Full Code Here

   public int authorize(Resource resource, Subject callerSubject, RoleGroup role)
   {
      if(resource instanceof WebResource == false)
         throw new IllegalArgumentException("resource is not a WebResource");
     
      WebResource webResource = (WebResource) resource;
     
      //Get the context map
      Map<String,Object> map = resource.getMap();
      if(map == null)
         throw new IllegalStateException("Map from the Resource is null");
     
      //Get the Request Object
      request = (HttpServletRequest) webResource.getServletRequest();
     
      webCS = webResource.getCodeSource();
      this.canonicalRequestURI = webResource.getCanonicalRequestURI();     

      String roleName = (String)map.get(ResourceKeys.ROLENAME);
      Principal principal = (Principal)map.get(ResourceKeys.HASROLE_PRINCIPAL);
      Set<Principal> roles = (Set<Principal>)map.get(ResourceKeys.PRINCIPAL_ROLES);
      String servletName = webResource.getServletName();
      Boolean resourceCheck = checkBooleanValue((Boolean)map.get(ResourceKeys.RESOURCE_PERM_CHECK));
      Boolean userDataCheck = checkBooleanValue((Boolean)map.get(ResourceKeys.USERDATA_PERM_CHECK));
      Boolean roleRefCheck = checkBooleanValue((Boolean)map.get(ResourceKeys.ROLEREF_PERM_CHECK));
     
      validatePermissionChecks(resourceCheck,userDataCheck,roleRefCheck);
View Full Code Here

   public int authorize(Resource resource, Subject subject, RoleGroup role)
   {
      if(resource instanceof WebResource == false)
         throw new IllegalArgumentException("resource is not a WebResource");
     
      WebResource webResource = (WebResource) resource;
     
      //Get the contextual map
      Map<String,Object> map = resource.getMap();
      if(map == null)
         throw new IllegalStateException("Map from the Resource is null");
   
      if(map.size() == 0)
         throw new IllegalStateException("Map from the Resource is size zero");
      //Get the Catalina Request Object
      //HttpServletRequest request = (HttpServletRequest)map.get(ResourceKeys.WEB_REQUEST);
     
      HttpServletRequest request = (HttpServletRequest)webResource.getServletRequest();
     
      this.policyRegistration = (PolicyRegistration) map.get(ResourceKeys.POLICY_REGISTRATION);
      if(this.policyRegistration == null)
         throw new IllegalStateException("PolicyRegistration passed is null");
     
View Full Code Here

      AuthorizationManager authzMgr = securityContext.getAuthorizationManager();
     
      boolean isAuthorized = false;

      WebResource webResource = new WebResource(Collections.unmodifiableMap(contextMap));
      webResource.setPolicyContextID(contextID);
      webResource.setServletRequest(request);
      webResource.setServletResponse(response);
      webResource.setCallerSubject(callerSubject);
      webResource.setCanonicalRequestURI(canonicalRequestURI);

      SecurityContextCallbackHandler sch = new SecurityContextCallbackHandler(this.securityContext);
      RoleGroup callerRoles = authzMgr.getSubjectRoles(callerSubject, sch);

      try
View Full Code Here

      map.put(ResourceKeys.ROLEREF_PERM_CHECK, Boolean.TRUE)
      map.put(ResourceKeys.PRINCIPAL_ROLES, principalRoles);

      map.put(ResourceKeys.POLICY_REGISTRATION, getPolicyRegistration());
     
      WebResource webResource = new WebResource(Collections.unmodifiableMap(map));
      webResource.setPolicyContextID(contextID);
      webResource.setPrincipal(principal);
      webResource.setServletName(servletName);
      
      webResource.setCallerSubject(callerSubject);
      SecurityContextCallbackHandler sch = new SecurityContextCallbackHandler(this.securityContext);
      RoleGroup callerRoles = authzMgr.getSubjectRoles(callerSubject, sch);
     
      try
      {
View Full Code Here

      AuthorizationManager authzMgr = securityContext.getAuthorizationManager();
     
      boolean hasPerm =  false;  
      contextMap.put(ResourceKeys.POLICY_REGISTRATION, getPolicyRegistration());
     
      WebResource webResource = new WebResource(Collections.unmodifiableMap(contextMap));
      webResource.setPolicyContextID(contextID);
      webResource.setServletRequest(request);
      webResource.setServletResponse(response);
     
      webResource.setCallerSubject(callerSubject);
      SecurityContextCallbackHandler sch = new SecurityContextCallbackHandler(this.securityContext);
      RoleGroup callerRoles = authzMgr.getSubjectRoles(callerSubject, sch);
     
      try
      {
View Full Code Here

   public int authorize(Resource resource, Subject subject, RoleGroup role)
   {
      if(resource instanceof WebResource == false)
         throw new IllegalArgumentException("resource is not a WebResource");
     
      WebResource webResource = (WebResource) resource;
     
      //Get the contextual map
      Map<String,Object> map = resource.getMap();
      if(map == null)
         throw new IllegalStateException("Map from the Resource is null");
   
      if(map.size() == 0)
         throw new IllegalStateException("Map from the Resource is size zero");
     
      HttpServletRequest request = (HttpServletRequest)webResource.getServletRequest();
     
      this.policyRegistration = (PolicyRegistration) map.get(ResourceKeys.POLICY_REGISTRATION);
      if(this.policyRegistration == null)
         throw new IllegalStateException("PolicyRegistration passed is null");
      this.policyContextID = webResource.getPolicyContextID()
     
      Boolean userDataCheck = checkBooleanValue((Boolean)map.get(ResourceKeys.USERDATA_PERM_CHECK));
      Boolean roleRefCheck = checkBooleanValue((Boolean)map.get(ResourceKeys.ROLEREF_PERM_CHECK));
     
      //If it is a userDataCheck or a RoleRefCheck, then the base class (RealmBase) decision holds
View Full Code Here

   public int authorize(Resource resource)
   {
      if(resource instanceof WebResource == false)
         throw new IllegalArgumentException("resource is not a WebResource");
     
      WebResource webResource = (WebResource) resource;
     
      //Get the context map
      Map<String,Object> map = resource.getMap();
      if(map == null)
         throw new IllegalStateException("Map from the Resource is null");
     
      //Get the Authorization Manager
      authorizationManager = (AuthorizationManager)map.get(ResourceKeys.AUTHORIZATION_MANAGER);
      if(authorizationManager == null)
         throw new IllegalStateException("Authorization Manager is null");
     
      //Get the Request Object
      request = (HttpServletRequest) webResource.getServletRequest();
     
      webCS = webResource.getCodeSource();
      this.canonicalRequestURI = webResource.getCanonicalRequestURI();     

      //Obtained by establishing subject context
      Subject callerSubject = webResource.getCallerSubject();
    
      String roleName = (String)map.get(ResourceKeys.ROLENAME);
      Principal principal = (Principal)map.get(ResourceKeys.HASROLE_PRINCIPAL);
      Set<Principal> roles = (Set<Principal>)map.get(ResourceKeys.PRINCIPAL_ROLES);
      String servletName = (String)map.get(ResourceKeys.SERVLET_NAME);
View Full Code Here

TOP

Related Classes of org.jboss.security.authorization.resources.WebResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.