Package org.jboss.security

Examples of org.jboss.security.SimplePrincipal


                        tx = inboundTxCurrent.getCurrentTransaction();
                    if (tx != null) {
                        transactionManager.resume(tx);
                    }
                    try {
                        SimplePrincipal principal = null;
                        Object credential = null;

                        if (sasCurrent != null) {
                            final byte[] incomingName = sasCurrent.get_incoming_principal_name();

                            if ( incomingName != null && incomingName.length > 0) {
                                //we have an identity token, which is a trust based mechanism
                                if (incomingName.length > 0) {
                                    String name = new String(incomingName, "UTF-8");
                                    int domainIndex = name.indexOf('@');
                                    if (domainIndex > 0)
                                        name = name.substring(0, domainIndex);
                                    principal = new SimplePrincipal(name);
                                    //we don't have any real way to establish trust here
                                    //we just use the SASCurrent as a credential, and a custom login
                                    //module can make a decision for us.
                                    credential = sasCurrent;
                                }
                            } else {
                                //the client has just sent a username and password
                                final byte[] username = sasCurrent.get_incoming_username();
                                final byte[] incomingPassword = sasCurrent.get_incoming_password();
                                if(username.length > 0) {
                                    String name = new String(username, "UTF-8");
                                    int domainIndex = name.indexOf('@');
                                    if (domainIndex > 0) {
                                        name = name.substring(0, domainIndex);
                                    }
                                    principal = new SimplePrincipal(name);
                                    credential = new String(incomingPassword, "UTF-8").toCharArray();
                                }
                            }

                            if (securityDomain != null) {
View Full Code Here


            methodRoles.add(NobodyPrincipal.NOBODY_PRINCIPAL);
        else if (this.ejbMethodSecurityMetaData.isPermitAll())
            methodRoles.add(AnybodyPrincipal.ANYBODY_PRINCIPAL);
        else {
            for (String role : this.ejbMethodSecurityMetaData.getRolesAllowed())
                methodRoles.add(new SimplePrincipal(role));
        }
        return methodRoles;
    }
View Full Code Here

            CallerPrincipalCallback cpc = cbh.getCallerPrincipalCallback();

            // get the client principal from the callback.
            Principal clientPrincipal = cpc.getPrincipal();
            if (clientPrincipal == null) {
                clientPrincipal = new SimplePrincipal(cpc.getName());
            }

            // if the client principal is not a jboss generic principal, we need to build one before registering.
            if (!(clientPrincipal instanceof JBossGenericPrincipal))
                clientPrincipal = this.buildJBossPrincipal(clientSubject, clientPrincipal);
View Full Code Here

   private boolean isAs5 = true;

   public boolean validateUser(final String user, final String password)
   {
      SimplePrincipal principal = new SimplePrincipal(user);

      char[] passwordChars = null;

      if (password != null)
      {
View Full Code Here

   public boolean validateUserAndRole(final String user,
                                      final String password,
                                      final Set<Role> roles,
                                      final CheckType checkType)
   {
      SimplePrincipal principal = user == null ? null : new SimplePrincipal(user);

      char[] passwordChars = null;

      if (password != null)
      {
View Full Code Here

      Set<Principal> principals = new HashSet<Principal>();
      for (Role role : roles)
      {
         if (checkType.hasRole(role))
         {
            principals.add(new SimplePrincipal(role.getName()));
         }
      }
      return principals;
   }
View Full Code Here

        JBossUserPrincipal() {}
       
        JBossUserPrincipal(String name, Logger log)
        {
            _principal = new SimplePrincipal(name);
            this._logRef = log;

            if (log.isDebugEnabled())
                log.debug("created JBossUserRealm::JBossUserPrincipal: " + name);
        }
View Full Code Here

            boolean isUserInRole = false;
           
            if (!_roleStack.isEmpty() && _roleStack.peek().equals(role))
                return true;

            Set requiredRoles = Collections.singleton(new SimplePrincipal(role));
            if (_realm._realmMapping != null
               && _realm._realmMapping.doesUserHaveRole(this._principal,requiredRoles))
            {
                if (_logRef.isDebugEnabled())
                    _logRef.debug("JBossUserPrincipal: " + _principal + " is in Role: " + role);
View Full Code Here

      if(ServerManagement.isRemote())
      {
         fail("This test is supposed to be run in a local configuration");
      }

      Principal nabopolassar = new SimplePrincipal("nabopolassar");
      Set principals = new HashSet();
      principals.add(nabopolassar);
      Subject subject =
         new Subject(false, principals, Collections.EMPTY_SET, Collections.EMPTY_SET);
      Principal nebuchadrezzar = new SimplePrincipal("nebuchadrezzar");

      SecurityAssociation.pushSubjectContext(subject, nebuchadrezzar, "xexe");

      Connection conn = null;
View Full Code Here

      MockJBossSecurityManager sm =
         (MockJBossSecurityManager)ic.lookup(MockJBossSecurityManager.TEST_SECURITY_DOMAIN);
      assertTrue(sm.isSimulateJBossJaasSecurityManager());

      Principal nabopolassar = new SimplePrincipal("nabopolassar");
      Set principals = new HashSet();
      principals.add(nabopolassar);
      Subject subject =
         new Subject(false, principals, Collections.EMPTY_SET, Collections.EMPTY_SET);
      Principal nebuchadrezzar = new SimplePrincipal("nebuchadrezzar");

      SecurityAssociation.pushSubjectContext(subject, nebuchadrezzar, "xexe");

      Connection conn = null;
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.