Package javax.security.auth

Examples of javax.security.auth.Subject


         impact=ManagedOperation.Impact.ReadOnly)
   public Subject createSubject(String securityDomainName)
   {
      if(this.securityManagement == null)
         throw new IllegalStateException("SecurityManagement has not been injected");
      Subject subject = new Subject();
      //Validate the caller
      Principal principal = SecurityActions.getPrincipal();
      AuthenticationManager authenticationManager = securityManagement.getAuthenticationManager(securityDomainName);
      if(authenticationManager == null)
      {
View Full Code Here


    * @param replaceRole flag whether the role has been replaced in the subject
    * @throws LoginException
    */
   private void processLogin(String config, boolean replaceRole) throws LoginException
   {
      Subject subject = new Subject();
      LoginContext lc = new LoginContext(config,subject, new TestCallbackHandler());
      lc.login();
      subject = lc.getSubject();
      Iterator iter = subject.getPrincipals().iterator();
      boolean ranAsserts = false;
      while(iter.hasNext())
      {
         Principal p = (Principal)iter.next();
         if(p instanceof SimpleGroup)
View Full Code Here

   {
      if(trace)
         log.trace("Session Destroy with id=" + httpSessionEvent.getSession().getId());
      try
      {
         Subject subject = getSubjectAndSecurityDomain();
         if(trace)
            log.trace("securityDomain="+ securityDomain);
         if(securityDomain == null)
            log.debug("Unable to obtain SecurityDomain");
         Principal principal = getPrincipal(subject);
View Full Code Here

      {
         log.debug("Obtaining SecurityManagerService failed::",e);
      }
      //First get the JACC Subject
      String SUBJECT_CONTEXT_KEY = "javax.security.auth.Subject.container";
      Subject subject = (Subject) PolicyContext.getContext(SUBJECT_CONTEXT_KEY);
      if(trace)
         log.trace("Jacc Subject = " + subject);
      if(mgr != null)
         securityDomain = mgr.getSecurityDomain();
       
View Full Code Here

   }

   protected void invokeHomeOnDelegate(final Method m, final Object[] args, final Object delegate)
      throws SecurityException
   {   // Get authenticated subject and invoke invokeAsSubject in Subject.doAsPrivaledged() block...
      final Subject subject = subjectSecurityManager.getActiveSubject();
      if (subject == null)
         throw new SecurityException("No subject associated with secure proxy");

      try
      {
View Full Code Here

   }

   protected void invokeOnDelegate(final Method m, final Object[] args, final Object delegate)
      throws Exception
   {   // Get authenticated subject and invoke invokeAsSubject in Subject.doAsPrivaledged() block...
      final Subject subject = subjectSecurityManager.getActiveSubject();
      if (subject == null)
         throw new SecurityException("No subject associated with secure proxy");

      try
      {
View Full Code Here

      //it is an explicit spec requirement that equals be used for matching rather than ==.
      if (!poolingStrategy.getManagedConnectionFactory().equals(mcf))
         throw new ResourceException("Wrong ManagedConnectionFactory sent to allocateConnection!");

      // Pick a managed connection from the pool
      Subject subject = getSubject();
      ConnectionListener cl = getManagedConnection(subject, cri);

      // Tell each connection manager the managed connection is active
      reconnectManagedConnection(cl);
View Full Code Here

      cl.registerConnection(c);
   }

   private Subject getSubject()
   {
      Subject subject = null;
      if(subjectFactory != null && securityDomainJndiName != null)
      {
         subject = subjectFactory.createSubject(securityDomainJndiName);
      }
      if (trace)
View Full Code Here

        CallbackHandler handler = new UsernamePasswordHandler("scott", "stark".toCharArray());
        try
        {
            LoginContext lc = new LoginContext("srp-login", handler);
            lc.login();
            Subject subject = lc.getSubject();
            System.out.println("Subject="+subject);
        }
        catch(LoginException e)
        {
            e.printStackTrace();
View Full Code Here

      ArrayList alist = new ArrayList();
     
      String SUBJECT_CONTEXT_KEY = "javax.security.auth.Subject.container";
      try
      {
         Subject caller = (Subject) PolicyContext.getContext(SUBJECT_CONTEXT_KEY);
         Iterator iter = caller.getPrincipals().iterator();
         while(iter != null && iter.hasNext())
         {
            Principal p = (Principal)iter.next();
            if(p instanceof SimpleGroup)
            {
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.