Package org.jboss.security

Examples of org.jboss.security.SimplePrincipal


      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


      {
         roles =  new SimpleGroup("Roles");
         subject.getPrincipals().add(roles);
      }

      roles.addMember(new SimplePrincipal(role));

   }
View Full Code Here

                MBeanServerConnection server = (MBeanServerConnection)context.lookup("jmx/invoker/RMIAdaptor");
                ObjectName objectName = new ObjectName("jboss.jca:name="+_dataSourceId+",service=ManagedConnectionFactory");
               
                if(_username !=null && _password !=null)
                {
                  SecurityAssociation.setPrincipal(new SimplePrincipal(_username));
                  SecurityAssociation.setCredential(_password);
                }
               
                String className = (String)server.invoke(objectName, "getManagedConnectionFactoryAttribute", new Object[] {"XADataSourceClass"}, new String[] {"java.lang.String"});
                log.debug("AppServerJDBCXARecovery datasource classname = "+className);

                if(_username !=null && _password !=null)
                {
                  SecurityAssociation.setPrincipal(new SimplePrincipal(_username));
                  SecurityAssociation.setCredential(_password);
                }
               
                String properties = (String)server.invoke(objectName, "getManagedConnectionFactoryAttribute", new Object[] {"XADataSourceProperties"}, new String[] {"java.lang.String"});
                // debug disabled due to security paranoia - it may log datasource password in cleartext.
                // log.debug("AppServerJDBCXARecovery.result="+properties);

                ObjectName txCmObjectName = new ObjectName("jboss.jca:name=" +_dataSourceId + ",service=XATxCM");

                if(_username !=null && _password !=null)
                {
                  SecurityAssociation.setPrincipal(new SimplePrincipal(_username));
                  SecurityAssociation.setCredential(_password);
                }               

                String securityDomainName = (String) server.getAttribute(txCmObjectName, "SecurityDomainJndiName");
                log.debug("Security domain name associated with JCA ConnectionManager jboss.jca:name=" +_dataSourceId + ",service=XATxCM"+" is:"+securityDomainName);

                if(securityDomainName != null && !securityDomainName.equals(""))
                {
                  ObjectName _objectName = new ObjectName("jboss.security:service=XMLLoginConfig");

                    if(_username !=null && _password !=null)
                    {
                        SecurityAssociation.setPrincipal(new SimplePrincipal(_username));
                        SecurityAssociation.setCredential(_password);
                    }

                  String config = (String)server.invoke(_objectName, "displayAppConfig", new Object[] {securityDomainName}, new String[] {"java.lang.String"});
                _dbUsername = getValueForKey(config, _USERNAME);
View Full Code Here

    * @param name
    * @return
    */
   private Principal createNewPrincipal(Group mappedObject, String name)
   {
      Principal p = new SimplePrincipal(name);
     
      //If the original group had a different principal than simpleprincipal
      if(mappedObject.members().hasMoreElements())
      {
         Principal origp = mappedObject.members().nextElement();
         p = MappingProviderUtil.instantiatePrincipal(origp.getClass(), name);
         if(p == null)
            p = new SimplePrincipal(name);
      }
      return p;
   }
View Full Code Here

  protected Group[] adicionarUsuarioGrupo(Funcionario funcionario){
    if (funcionario == null)
      throw new IllegalArgumentException("Usuario null");
   
    SimpleGroup sg = new SimpleGroup("Roles");   
    sg.addMember(new SimplePrincipal(funcionario.getCargo()));
 
    return new Group[]{sg};
 
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
      if( restoreLoginIdentity )
      {
         SecurityAssociationActions.setPrincipalInfo(securityPrincipal, credentials, null);
View Full Code Here

   /** Build a SimplePrincipal
    * @param text, the name of the Principal
    */
   public void setAsText(final String text)
   {
      SimplePrincipal principal = new SimplePrincipal(text);
      setValue(principal);
   }
View Full Code Here

   private boolean authoriseOnClientLogin = false;

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

      char[] passwordChars = null;

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

      return AccessController.doPrivileged(new PrivilegedAction<Boolean>()
      {
         public Boolean run()
         {

            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

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.