Package javax.security.auth

Examples of javax.security.auth.Subject


    */
   public Object invoke(Invocation invocation) throws Throwable
   {
    SecurityContext previousSC = null;
      String type = invocation.getType();
      Subject subject = null;
      if (!initialized)
         initialize();
      if (type == Invocation.OP_INVOKE && securityMgr != null)
      {
         String opName = invocation.getName();
         if (opName.equals("invoke"))
         {
            Object[] args = invocation.getArgs();
            org.jboss.invocation.Invocation inv = (org.jboss.invocation.Invocation) args[0];
            // Authenticate the caller based on the security association
            Principal caller = inv.getPrincipal();
            Object credential = inv.getCredential();
            subject = new Subject();
            boolean isValid = securityMgr.isValid(caller, credential, subject);
            if (isValid == false)
            {
               String msg = "Failed to authenticate principal=" + caller + ", securityDomain="
                     + securityMgr.getSecurityDomain();
View Full Code Here


      TomcatJASPICallbackHandler cbh = new TomcatJASPICallbackHandler();
     
      ServerAuthenticationManager sam = getServerAuthenticationManager();
      if(sam != null)
      {
         result = sam.isValid(messageInfo, new Subject(), messageLayer, cbh);
      }
     
      //The Authentication process has been a success. We need to register
      //the principal, username, password with the container
      if(result)
View Full Code Here

         {
            SecurityRoleRefMetaData meta = (SecurityRoleRefMetaData) it.next();
            securityRoleRefs.add(new SecurityRoleRef(meta.getName(), meta.getLink(),meta.getDescription()));
         }
         //Get the context subject
         Subject contextSubject = null;
         try
         {
            contextSubject = SecurityActions.getContextSubject();
            if(contextSubject == null)
               log.error("Subject is null for isCallerInRole Check with role="+roleName);
View Full Code Here

         LoginConfig config) throws Exception
   {
      log.debug("ExtendedSecurityMgrRealm:authenticate");
      MessageInfo authParam = new GenericMessageInfo(request, request.getResponse());
      GeneralizedAuthenticationManager gam = getAuthenticationManager();
      Subject clientSubject = new Subject();
      Subject serviceSubject = new Subject();
      Map sharedState = getSharedState(request,config);
      AuthStatus status = AuthStatus.FAILURE;
      while(!status.equals(AuthStatus.SEND_CONTINUE))
      {
         status = gam.validateRequest(authParam, clientSubject, serviceSubject);
View Full Code Here

   private int getResult(String policyName) throws Exception
   {
      int result = AuthorizationContext.DENY;
     
      JBossAuthorizationContext aContext = new JBossAuthorizationContext(policyName,
            new Subject(),
            new TestCallbackHandler());
      aContext.setApplicationPolicy(policyConfig.get(policyName));
      try
      {
         result =  aContext.authorize(new Resource()
View Full Code Here

         // Get the JBoss security manager from the ENC context
         SubjectSecurityManager securityMgr = getSubjectSecurityManager("authenticate(X509Certificate[] certs)");
         if(securityMgr == null)
            return null;
        
         Subject subject = new Subject();
         principal = certMapping.toPrinicipal(certs);
         if (securityMgr.isValid(principal, certs, subject))
         {
            if (trace)
            {
View Full Code Here

         SubjectSecurityManager securityMgr = getSubjectSecurityManager("authenticate( digest related)");
         if(securityMgr == null)
            return null;
        
         principal = new SimplePrincipal(username);
         Subject subject = new Subject();
         if (securityMgr.isValid(principal, digest, subject))
         {
            log.trace("User: " + username + " is authenticated");
            securityDomain = securityMgr.getSecurityDomain();
            SecurityAssociationActions.setPrincipalInfo(principal, digest, subject);
View Full Code Here

         SubjectSecurityManager securityMgr = getSubjectSecurityManager("authenticate(username,cred)");
         if(securityMgr == null)
            return null;
        
         principal = new SimplePrincipal(username);
         Subject subject = new Subject();
         if (securityMgr.isValid(principal, credentials, subject))
         {
            log.trace("User: " + username + " is authenticated");
            securityDomain = securityMgr.getSecurityDomain();
            SecurityAssociationActions.setPrincipalInfo(principal, credentials, subject);
View Full Code Here

      //By default, the authorization framework always returns PERMIT such that the
      //decision of the realm base holds.
      if (baseDecision && !ignoreJBossAuthorization)
      {
         Subject caller = this.establishSubjectContext(request.getPrincipal());

         PolicyRegistration policyRegistration = getPolicyRegistration();

         SecurityContext sc = SecurityAssociationActions.getSecurityContext();
         Map<String, Object> contextMap = new HashMap<String, Object>();
View Full Code Here

         {
            log.error("Error obtaining helper", e);
         }
         helper.setPolicyRegistration(getPolicyRegistration());
         helper.setEnableAudit(enableAudit);
         Subject callerSubject = SecurityAssociationActions.getSubject();
         if (callerSubject == null)
         {
            //During hasResourcePermission check, catalina calls hasRole. But we have not established
            // a subject yet in the security context. So we will get the subject from the cached principal
            callerSubject = SecurityAssociationActions.getSubjectFromRequestPrincipal(principal);
View Full Code Here

TOP

Related Classes of javax.security.auth.Subject

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.