Examples of doesUserHaveRole()


Examples of org.jboss.metadata.javaee.jboss.RunAsIdentityMetaData.doesUserHaveRole()

      RunAsIdentityMetaData s19RunAsID = jbossWeb.getRunAsIdentity("UnsecureRunAsServletWithPrincipalNameAndRoles");
      assertEquals("UnsecureRunAsServletWithPrincipalNameAndRolesPrincipal", s19RunAsID.getPrincipalName());
      Set<String> s19RunAsPrincipalRoles = jbossWeb.getSecurityRoles().getSecurityRoleNamesByPrincipal("UnsecureRunAsServletWithPrincipalNameAndRolesPrincipal");
      assertEquals(set("ExtraRole1"), s19RunAsPrincipalRoles);
      assertEquals(set("ExtraRole1", "InternalUser"), s19RunAsID.getRunAsRoles());
      assertEquals(true, s19RunAsID.doesUserHaveRole("ExtraRole1"));
      assertEquals(true, s19RunAsID.doesUserHaveRole("InternalUser"));
      // servlet20
      JBossServletMetaData servlet20 = jbossWeb.getServletByName("UnsecureRunAsJsp");
      assertNotNull(servlet20);
      assertEquals("servlet20", servlet20.getId());
View Full Code Here

Examples of org.jboss.metadata.javaee.jboss.RunAsIdentityMetaData.doesUserHaveRole()

      assertEquals("UnsecureRunAsServletWithPrincipalNameAndRolesPrincipal", s19RunAsID.getPrincipalName());
      Set<String> s19RunAsPrincipalRoles = jbossWeb.getSecurityRoles().getSecurityRoleNamesByPrincipal("UnsecureRunAsServletWithPrincipalNameAndRolesPrincipal");
      assertEquals(set("ExtraRole1"), s19RunAsPrincipalRoles);
      assertEquals(set("ExtraRole1", "InternalUser"), s19RunAsID.getRunAsRoles());
      assertEquals(true, s19RunAsID.doesUserHaveRole("ExtraRole1"));
      assertEquals(true, s19RunAsID.doesUserHaveRole("InternalUser"));
      // servlet20
      JBossServletMetaData servlet20 = jbossWeb.getServletByName("UnsecureRunAsJsp");
      assertNotNull(servlet20);
      assertEquals("servlet20", servlet20.getId());
      assertEquals("UnsecureRunAsJsp", servlet20.getServletName());
View Full Code Here

Examples of org.jboss.metadata.javaee.jboss.RunAsIdentityMetaData.doesUserHaveRole()

      assertEquals("InternalUser", s20RunAs.getRoleName());
      assertEquals(null, servlet20.getRunAsPrincipal());
      RunAsIdentityMetaData s20RunAsID = jbossWeb.getRunAsIdentity("UnsecureRunAsJsp");
      assertEquals("anonymous", s20RunAsID.getPrincipalName());
      assertEquals(set("InternalUser"), s20RunAsID.getRunAsRoles());
      assertEquals(true, s20RunAsID.doesUserHaveRole("InternalUser"));
      // servlet27
      JBossServletMetaData servlet27 = jbossWeb.getServletByName("UserInRoleServlet");
      assertEquals("servlet27", servlet27.getId());
      assertEquals("UserInRoleServlet", servlet27.getServletName());
      assertEquals("org.jboss.test.web.servlets.UserInRoleServlet", servlet27.getServletClass());
View Full Code Here

Examples of org.jboss.security.AuthorizationManager.doesUserHaveRole()

    */
   public boolean doesUserHaveRole(Principal principal, Set<Principal> rolePrincipals)
   {
      AuthorizationManager am = SecurityUtil.getAuthorizationManager(securityDomain,
            SecurityConstants.JAAS_CONTEXT_ROOT);
      return am.doesUserHaveRole(principal, rolePrincipals);
   }

   /** Return the set of domain roles the current active Subject 'Roles' group
      found in the subject Principals set.

View Full Code Here

Examples of org.jboss.security.AuthorizationManager.doesUserHaveRole()

         throw new SecurityException("AuthorizationManager is null for domain=" + securityDomain);
      boolean hasRole = AccessController.doPrivileged(new PrivilegedAction<Boolean>()
      {
         public Boolean run()
         {
             return authorizationManager.doesUserHaveRole(principal, rolePrincipals);
         }});

      if (trace)
      {
         log.trace("user " + user + (hasRole ? " is " : " is NOT ") + "authorized");
View Full Code Here

Examples of org.jboss.security.AuthorizationManager.doesUserHaveRole()

    */
   public boolean doesUserHaveRole(Principal principal, Set<Principal> rolePrincipals)
   {
      AuthorizationManager am = SecurityUtil.getAuthorizationManager(securityDomain,
            SecurityConstants.JAAS_CONTEXT_ROOT);
      return am.doesUserHaveRole(principal, rolePrincipals);
   }

   /** Return the set of domain roles the current active Subject 'Roles' group
      found in the subject Principals set.

View Full Code Here

Examples of org.jboss.security.AuthorizationManager.doesUserHaveRole()

    */
   public boolean doesUserHaveRole(Principal principal, Set<Principal> rolePrincipals)
   {
      AuthorizationManager am = SecurityUtil.getAuthorizationManager(securityDomain,
            SecurityConstants.JAAS_CONTEXT_ROOT);
      return am.doesUserHaveRole(principal, rolePrincipals);
   }

   /** Return the set of domain roles the current active Subject 'Roles' group
      found in the subject Principals set.

View Full Code Here

Examples of org.jboss.security.AuthorizationManager.doesUserHaveRole()

    */
   public boolean doesUserHaveRole(Principal principal, Set<Principal> rolePrincipals)
   {
      AuthorizationManager am = SecurityUtil.getAuthorizationManager(securityDomain,
            SecurityConstants.JAAS_CONTEXT_ROOT);
      return am.doesUserHaveRole(principal, rolePrincipals);
   }

   /** Return the set of domain roles the current active Subject 'Roles' group
      found in the subject Principals set.

View Full Code Here

Examples of org.jboss.security.AuthorizationManager.doesUserHaveRole()

         if (callerRunAs == null)
         {
            AuthorizationManager am = (AuthorizationManager)policyRegistration;
           
            // Now actually check if the current caller has one of the required method roles
            if (am.doesUserHaveRole(ejbPrincipal, methodRoles) == false)
            {
               if(this.ejbMethod == null)
                  throw new IllegalStateException("ejbMethod is null");
              
               Set<Principal> userRoles = am.getUserRoles(ejbPrincipal);
View Full Code Here

Examples of org.jboss.security.AuthorizationManager.doesUserHaveRole()

      HashSet<Principal> set = new HashSet<Principal>();
      set.add(new SimplePrincipal(roleName));

      boolean allowed = false;
      if (callerRunAs == null)
         allowed = am.doesUserHaveRole(ejbPrincipal, set);
      else
      {
         if(callerRunAs instanceof RunAsIdentity)
         {
            RunAsIdentity callerRunAsIdentity = (RunAsIdentity) callerRunAs;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.