Package org.jboss.security

Examples of org.jboss.security.SecurityContextUtil


   }
  
   private SecurityContext login(String name, Object credential) throws Exception
   {
      SecurityContext sc = SecurityContextFactory.createSecurityContext("test");
      SecurityContextUtil util = sc.getUtil();
      Principal principal = new SimplePrincipal(name);
      Subject subject = new Subject();
      subject.getPrincipals().add(principal);
      subject.getPrivateCredentials().add(credential);
      util.createSubjectInfo(principal, credential, subject);
      SecurityContextAssociation.setSecurityContext(sc);
      return sc;
   }
View Full Code Here


   }

   private SecurityContext login(String name, Object credential) throws Exception
   {
      SecurityContext sc = SecurityContextFactory.createSecurityContext("test");
      SecurityContextUtil util = sc.getUtil();
      Principal principal = new SimplePrincipal(name);
      Subject subject = new Subject();
      subject.getPrincipals().add(principal);
      subject.getPrivateCredentials().add(credential);
      util.createSubjectInfo(principal, credential, subject);
      SecurityContextAssociation.setSecurityContext(sc);
      return sc;
   }
View Full Code Here

/* 137 */     this.outgoingRunAs = runAs;
/*     */   }
/*     */
/*     */   public SecurityContextUtil getUtil()
/*     */   {
/* 145 */     SecurityContextUtil util = null;
/*     */     try
/*     */     {
/* 148 */       util = SecurityContextFactory.createUtil(this);
/*     */     }
/*     */     catch (Exception e)
View Full Code Here

   }
  
   private SecurityContext login(String name, Object credential) throws Exception
   {
      SecurityContext sc = SecurityContextFactory.createSecurityContext("test");
      SecurityContextUtil util = sc.getUtil();
      Principal principal = new SimplePrincipal(name);
      Subject subject = new Subject();
      subject.getPrincipals().add(principal);
      subject.getPrivateCredentials().add(credential);
      util.createSubjectInfo(principal, credential, subject);
      SecurityContextAssociation.setSecurityContext(sc);
      return sc;
   }
View Full Code Here

            current.setOutgoingRunAs(previous.getOutgoingRunAs());
        }
    }

    private boolean authenticate(SecurityContext context) {
        SecurityContextUtil util = context.getUtil();
        SubjectInfo subjectInfo = context.getSubjectInfo();
        Subject subject = new Subject();
        Principal principal = util.getUserPrincipal();
        Object credential = util.getCredential();

        boolean authenticated = false;
        if (principal == null) {
            Identity unauthenticatedIdentity = getUnauthenticatedIdentity();
            subjectInfo.addIdentity(unauthenticatedIdentity);
View Full Code Here

        // TODO - Set unauthenticated identity if no auth to occur
        if (trusted == false) {
            if (RemotingContext.isSet()) {
                // In this case the principal and credential will not have been set to set some random values.
                SecurityContextUtil util = current.getUtil();

                Principal p = new SimplePrincipal(UUID.randomUUID().toString());
                String credential = UUID.randomUUID().toString();

                util.createSubjectInfo(p, credential, null);
            }

            // If we have a trusted identity no need for a re-auth.
            boolean authenticated = authenticate(current);
            if (authenticated == false) {
View Full Code Here

            current.setOutgoingRunAs(previous.getOutgoingRunAs());
        }
    }

    private boolean authenticate(SecurityContext context) {
        SecurityContextUtil util = context.getUtil();
        SubjectInfo subjectInfo = context.getSubjectInfo();
        Subject subject = new Subject();
        Principal principal = util.getUserPrincipal();
        Object credential = util.getCredential();

        boolean authenticated = false;
        if (principal == null) {
            Identity unauthenticatedIdentity = getUnauthenticatedIdentity();
            subjectInfo.addIdentity(unauthenticatedIdentity);
View Full Code Here

TOP

Related Classes of org.jboss.security.SecurityContextUtil

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.