Package org.jboss.security

Examples of org.jboss.security.SubjectInfo


   @Override
   public Principal getUserPrincipal()
   { 
      validateSecurityContext();
      Principal p = null;
      SubjectInfo subjectInfo = this.securityContext.getSubjectInfo();
      if(subjectInfo != null)
      {
         p = subjectInfo.getAuthenticationPrincipal();
      }
      return p;
   }
View Full Code Here


  
   public Object getCredential()
   {
      validateSecurityContext();
      Object cred = null;
      SubjectInfo subjectInfo = this.securityContext.getSubjectInfo();
      if(subjectInfo != null)
      {
         cred = subjectInfo.getAuthenticationCredential();
      }
      return cred;
   }
View Full Code Here

  
   public Subject getSubject()
   {
      validateSecurityContext();
      Subject s = null;
      SubjectInfo subjectInfo = this.securityContext.getSubjectInfo();
      if(subjectInfo != null)
      {
         s = subjectInfo.getAuthenticatedSubject();
      }
      return s;
   }
View Full Code Here

      {
         Subject theSubject = null;
         SecurityContext sc = SecurityContextAssociation.getSecurityContext();
         if(sc != null)
         {
            SubjectInfo si = sc.getSubjectInfo();
           
            if(si != null)
            {
               Subject activeSubject = si.getAuthenticatedSubject();
               RunAsIdentity callerRunAsIdentity = (RunAsIdentity)sc.getIncomingRunAs();
              
               if( activeSubject != null )
               {
                  Set principalsSet = null;
View Full Code Here

        }
    }

    private boolean authenticate(SecurityContext context, Subject subject) {
        SecurityContextUtil util = context.getUtil();
        SubjectInfo subjectInfo = context.getSubjectInfo();
        if (subject == null) {
            subject = new Subject();
        }
        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();
            authenticated = authenticationManager.isValid(principal, credential, subject);
        }
        if (authenticated == true) {
            subjectInfo.setAuthenticatedSubject(subject);
        }

        return authenticated;
    }
View Full Code Here

      assertNull("Subject is null", subject);
     
      //We have to ensure that the first successful authentication has not been removed from the stack
      currentSC = SecurityContextAssociation.getSecurityContext();
      assertNotNull("Current Security Context is not null", currentSC);
      SubjectInfo subjectInfo = currentSC.getSubjectInfo();
      assertNotNull("SubjectInfo", subjectInfo);
      subject = subjectInfo.getAuthenticatedSubject();
      assertNull("Subject is null", subject);
      assertNull("Principal on security context is null", currentSC.getUtil().getUserPrincipal());
      assertNull("Principal on legacy security association is null", SecurityAssociation.getPrincipal());
   }
View Full Code Here

      assertNull("Principal on legacy security association is null", SecurityAssociation.getPrincipal());
   }
  
   private void verifySubjectInfo(SecurityContext currentSC)
   {
      SubjectInfo subjectInfo = currentSC.getSubjectInfo();
      assertNotNull("SubjectInfo", subjectInfo);
      Subject subject = subjectInfo.getAuthenticatedSubject();
      assertNotNull("Subject is not null", subject);
      Principal jduke = new SimplePrincipal("jduke");
      assertTrue("jduke exists in the subject",subject.getPrincipals().contains(jduke));
      assertEquals("jduke exists", jduke, currentSC.getUtil().getUserPrincipal());
      assertEquals("jduke exists", jduke, SecurityAssociation.getPrincipal());
View Full Code Here

      assertEquals("JBossSecurityClient", JBossSecurityClient.class,client.getClass());
      client.setSimple("anil", "pass");
      client.login();
      SecurityContext sc = SecurityContextAssociation.getSecurityContext();
      assertNotNull("SecurityContext is not null", sc);
      SubjectInfo si = sc.getSubjectInfo();
      assertNotNull("SubjectInfo is not null", si);
      assertNotNull("Principal is not null", sc.getUtil().getUserPrincipal());
      assertEquals("Principal==anil", "anil", sc.getUtil().getUserPrincipal().getName());
      assertNotNull("Cred is not null", sc.getUtil().getCredential());
      assertEquals("Cred==pass", "pass", sc.getUtil().getCredential());
View Full Code Here

      client.setSimple("anil", "pass");
      client.login();
     
      SecurityContext sc = SecurityContextAssociation.getSecurityContext();
      assertNotNull("SecurityContext is not null", sc);
      SubjectInfo si = sc.getSubjectInfo();
      assertNotNull("SubjectInfo is not null", si);
      assertNotNull("Principal is not null", sc.getUtil().getUserPrincipal());
      assertEquals("Principal==anil", "anil", sc.getUtil().getUserPrincipal().getName());
      assertNotNull("Cred is not null", sc.getUtil().getCredential());
      assertEquals("Cred==pass", "pass", sc.getUtil().getCredential());
View Full Code Here

/*     */     {
/*  55 */       Subject theSubject = null;
/*  56 */       SecurityContext sc = SecurityContextAssociation.getSecurityContext();
/*  57 */       if (sc != null)
/*     */       {
/*  59 */         SubjectInfo si = sc.getSubjectInfo();
/*     */
/*  61 */         if (si != null)
/*     */         {
/*  63 */           Subject activeSubject = si.getAuthenticatedSubject();
/*  64 */           RunAsIdentity callerRunAsIdentity = (RunAsIdentity)sc.getIncomingRunAs();
/*     */
/*  66 */           if (activeSubject != null)
/*     */           {
/*  68 */             Set principalsSet = null;
View Full Code Here

TOP

Related Classes of org.jboss.security.SubjectInfo

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.