Package org.jboss.security.identity

Examples of org.jboss.security.identity.Identity


             */
            String unauthenticatedPrincipal = domain.unauthenticatedPrincipal();
            if(sc.getUtil().getUserPrincipal() == null && unauthenticatedPrincipal !=null &&
                  unauthenticatedPrincipal.length() > 0)
            {
               Identity unauthenticatedIdentity = new SimpleIdentity(unauthenticatedPrincipal);
               sc.getSubjectInfo().addIdentity(unauthenticatedIdentity);
               subject.getPrincipals().add(unauthenticatedIdentity.asPrincipal());
            }
            else
            {
               //Authenticate the caller now
               if(!helper.isValid(subject, method.getName()))
View Full Code Here


   {
      AccessController.doPrivileged(new PrivilegedAction<Object>()
      {
         public Object run()
         {
            Identity identity = new SimpleIdentity(principal.getName());

            SecurityContext sc = getSecurityContext();
            if(sc == null)
               throw new RuntimeException("No Security Context");
            sc.getUtil().addIdentity(identity);
View Full Code Here

    * @param identityString a {@code String} representation of the identity to be created.
    * @return   the constructed {@code Identity} instance.
    */
   public static Identity getIdentityFromString(String identityString)
   {
      Identity identity = null;
      if (identityString != null)
      {
         String[] identityParts = identityString.split(":");
         if (identityParts.length != 2)
            throw new IllegalArgumentException("Malformed identity String: " + identityString);
View Full Code Here

      ObjectInputStream ois = null;
      try
      {
         FileInputStream fis = new FileInputStream(path + File.separator + name);
         ois = new ObjectInputStream(fis);
         Identity identity = (Identity) ois.readObject();
         return identity;
      }
      catch (Exception e)
      {
         //TODO
View Full Code Here

            Object credential = !credentials.isEmpty() ? credentials.iterator().next() : null;
            org.jboss.security.SecurityContext new_jb_securityContext = SecurityContextFactory.createSecurityContext(securityDomain);
            SecurityContextAssociation.setSecurityContext(new_jb_securityContext);
            if (rolesGroup != null) {
                RoleGroup roleGroup = new SimpleRoleGroup(rolesGroup);
                Identity identity = CredentialIdentityFactory.createIdentity(principal, credential, roleGroup);
                new_jb_securityContext.getUtil().createSubjectInfo(identity, subject);
                new_jb_securityContext.getSubjectInfo().setRoles(roleGroup);
            } else {
                Identity identity = CredentialIdentityFactory.createIdentity(principal, credential);
                new_jb_securityContext.getUtil().createSubjectInfo(identity, subject);
            }
            if (new_jb_runAs != null) {
                new_jb_securityContext.setOutgoingRunAs(new_jb_runAs);
            }
View Full Code Here

      if(ids != null)
      {
         Iterator<Identity> iter = ids.iterator();
         while(iter.hasNext())
         {
            Identity id = iter.next();
            if(clazz.isAssignableFrom(id.getClass()))
               resultSet.add(id);
         }
      }
      return resultSet;
   }
View Full Code Here

     
      sc.getUtil().createSubjectInfo(getIdentity(), null)
     
      Set<Identity> iset = sc.getUtil().getIdentities(SAMLIdentity.class);
      assertEquals(1, iset.size());
      Identity id = iset.iterator().next();
      assertEquals(getIdentity(), id);
      assertTrue(id instanceof SAMLIdentity);
      assertTrue(((SAMLIdentity)id).getSAMLObject() instanceof FedIdentityObject);
   }
View Full Code Here

        Principal principal = util.getUserPrincipal();
        Object credential = util.getCredential();

        boolean authenticated = false;
        if (principal == null) {
            Identity unauthenticatedIdentity = getUnauthenticatedIdentity();
            subjectInfo.addIdentity(unauthenticatedIdentity);
            subject.getPrincipals().add(unauthenticatedIdentity.asPrincipal());
            authenticated = true;
        }

        if (authenticated == false) {
            AuthenticationManager authenticationManager = context.getAuthenticationManager();
View Full Code Here

        Principal principal = util.getUserPrincipal();
        Object credential = util.getCredential();

        boolean authenticated = false;
        if (principal == null) {
            Identity unauthenticatedIdentity = getUnauthenticatedIdentity();
            subjectInfo.addIdentity(unauthenticatedIdentity);
            subject.getPrincipals().add(unauthenticatedIdentity.asPrincipal());
            authenticated = true;
        }

        if (authenticated == false) {
            AuthenticationManager authenticationManager = context.getAuthenticationManager();
View Full Code Here

                if (context != null) {
                    final Set<Identity> identities = context.getSubjectInfo().getIdentities();
                    if (identities.isEmpty()) {
                        ncb.setName(DOLLAR_LOCAL);
                    } else {
                        final Identity identity = identities.iterator().next();
                        ncb.setName(identity.getName());
                    }
                } else {
                    ncb.setName(DOLLAR_LOCAL);
                }
            } else if (current instanceof PasswordCallback) {
                if (context != null) {
                    final PasswordCallback pcb = (PasswordCallback) current;
                    final Set<Identity> identities = context.getSubjectInfo().getIdentities();
                    if (identities.isEmpty()) {
                        throw new UnsupportedCallbackException(current);
                    } else {
                        final Identity identity = identities.iterator().next();
                        if (identity instanceof CredentialIdentity) {
                            pcb.setPassword((char[]) ((CredentialIdentity) identity).getCredential());
                        } else {
                            throw new UnsupportedCallbackException(current);
                        }
View Full Code Here

TOP

Related Classes of org.jboss.security.identity.Identity

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.