Package org.jboss.security

Examples of org.jboss.security.SimplePrincipal


            return true;

        if (securityDomainContext == null)
            throw MESSAGES.securityDomainContextNotSet();

        return securityDomainContext.getAuthenticationManager().isValid(new SimplePrincipal(username), password, new Subject());
    }
View Full Code Here


            throw MESSAGES.securityDomainContextNotSet();

        Subject subject = new Subject();

        // The authentication call here changes the subject and that subject must be used later.  That is why we don't call validateUser(String, String) here.
        boolean authenticated = securityDomainContext.getAuthenticationManager().isValid(new SimplePrincipal(username), password, subject);

        if (authenticated) {
            SecurityContext securityContext = pushSecurityContext(subject, new SimplePrincipal(username), password);
            Set<Principal> principals = new HashSet<Principal>();
            for (Role role : roles) {
                if (checkType.hasRole(role)) {
                    principals.add(new SimplePrincipal(role.getName()));
                }
            }

            authenticated = securityDomainContext.getAuthorizationManager().doesUserHaveRole(new SimplePrincipal(username), principals);

            // restore the previous security context if any
            setSecurityContextOnAssociation(securityContext);
        }
View Full Code Here

        return null;
    }

    @Override
    protected Principal getPrincipal(String username) {
        return new SimplePrincipal(username);
    }
View Full Code Here

   public boolean login() throws LoginException
   {
      if( super.login() == true )
         return true;

      Principal principal = new SimplePrincipal(principalName);
      subject.getPrincipals().add(principal);
      // Put the principal name into the sharedState map
      sharedState.put("javax.security.auth.login.name", principalName);
      super.loginOk = true;
      return true;
View Full Code Here

      return true;
   }

   protected Principal getIdentity()
   {
      Principal principal = new SimplePrincipal(principalName);
      return principal;
   }
View Full Code Here

      {
         StringTokenizer tokenizer = new StringTokenizer(roleNames, ",");
         while( tokenizer.hasMoreTokens() )
         {
            String roleName = tokenizer.nextToken();
            roles.addMember(new SimplePrincipal(roleName));
         }
      }
      return roleSets;
   }
View Full Code Here

         throw new IllegalStateException("Expected to find the username in the shared state");

      if (username instanceof Principal)
         return (Principal)username;

      return new SimplePrincipal((String)username);
   }
View Full Code Here

      Group group = new SimpleGroup("Roles");
      Iterator itRoleNames = getSecurityRoleNames().iterator();
      while (itRoleNames.hasNext())
      {
         String roleName = (String) itRoleNames.next();
         group.addMember(new SimplePrincipal(roleName));
      }

      return new Group[]{group};
   }
View Full Code Here

      }
      else
      {
         // Simply convert this to a name using toString
         String username = principal.toString();
         securityPrincipal = new SimplePrincipal(username);
      }
      // Associate this security context
      SecurityAssociationActions.setPrincipalInfo(securityPrincipal, credentials);
      // Now return the context using the standard jnp naming context factory
      Context iniCtx = super.getInitialContext(env);
View Full Code Here

      throws Exception
   {
      Principal p = null;
      if( principalClassName == null )
      {
         p = new SimplePrincipal(username);
      }
      else
      {
            ClassLoader loader = Thread.currentThread().getContextClassLoader();
            Class clazz = loader.loadClass(principalClassName);
View Full Code Here

TOP

Related Classes of org.jboss.security.SimplePrincipal

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.