Package javax.resource.spi.security

Examples of javax.resource.spi.security.PasswordCredential


        return resourcePrincipalName != null && userName != null && password != null;
    }

    public boolean commit() throws LoginException {
        subject.getPrincipals().add(new ResourcePrincipal(resourcePrincipalName));
        PasswordCredential passwordCredential = new PasswordCredential(userName, password);
        passwordCredential.setManagedConnectionFactory(passwordCredentialRealm.getManagedConnectionFactory());
        subject.getPrivateCredentials().add(passwordCredential);
        return true;
    }
View Full Code Here


               // Principals
               Principal p = new SimplePrincipal(recoverUserName);
               subject.getPrincipals().add(p);

               // PrivateCredentials
               PasswordCredential pc = new PasswordCredential(recoverUserName, recoverPassword.toCharArray());
               pc.setManagedConnectionFactory(mcf);
               subject.getPrivateCredentials().add(pc);

               // PublicCredentials
               // None

               log.debugf("Recovery Subject=%s", subject);

               return subject;
            }
            else
            {
               // Security-domain use-case
               try
               {
                  // Select the domain
                  String domain = recoverSecurityDomain;

                  if (domain != null && subjectFactory != null)
                  {
                     Subject subject = subjectFactory.createSubject(domain);
                    
                     Set<PasswordCredential> pcs = subject.getPrivateCredentials(PasswordCredential.class);
                     if (pcs != null && pcs.size() > 0)
                     {
                        for (PasswordCredential pc : pcs)
                        {
                           pc.setManagedConnectionFactory(mcf);
                        }
                     }

                     log.debugf("Recovery Subject=%s", subject);
View Full Code Here

         while (i.hasNext())
         {
            Object o = i.next();
            if (o instanceof PasswordCredential)
            {
               PasswordCredential cred = (PasswordCredential) o;
               if (cred.getManagedConnectionFactory().equals(mcf))
               {
                  props.setProperty("user", (cred.getUserName() == null) ? "" : cred.getUserName());
                  if( cred.getPassword() != null )
                     props.setProperty("password", new String(cred.getPassword()));
                  return Boolean.TRUE;
               }
            }
         }
         return Boolean.FALSE;
View Full Code Here

      jc.pwd = ((JmsConnectionRequestInfo) info).getPassword();
    }
    else if (subject != null)
    {
      // Credentials from appserver
      PasswordCredential pwdc = GetCredentialAction.getCredential(subject, mcf);
      if (pwdc == null)
      {
        // No hit - we do need creds
        throw new SecurityException("No Password credentials found");
      }
      jc.name = pwdc.getUserName();
      jc.pwd = new String(pwdc.getPassword());
    }
    else
    {
      throw new SecurityException("No Subject or ConnectionRequestInfo set, could not get credentials");
    }
View Full Code Here

         this.mcf = mcf;
      }
      public Object run()
      {
         Set creds = subject.getPrivateCredentials(PasswordCredential.class);
         PasswordCredential pwdc = null;
         Iterator credentials = creds.iterator();
         while (credentials.hasNext())
         {
            PasswordCredential curCred = (PasswordCredential) credentials.next();
            if (curCred.getManagedConnectionFactory().equals(mcf))
            {
               pwdc = curCred;
               break;
            }
         }
View Full Code Here

         return pwdc;
      }
      static PasswordCredential getCredential(Subject subject, ManagedConnectionFactory mcf)
      {
         GetCredentialAction action = new GetCredentialAction(subject, mcf);
         PasswordCredential pc = (PasswordCredential) AccessController.doPrivileged(action);
         return pc;
      }
View Full Code Here

        if (resourcePrincipalName == null || userName == null || password == null) {
            return false;
        }
        resourcePrincipal = new ResourcePrincipal(resourcePrincipalName);
        subject.getPrincipals().add(resourcePrincipal);
        passwordCredential = new PasswordCredential(userName, password);
        passwordCredential.setManagedConnectionFactory(managedConnectionFactory);
        subject.getPrivateCredentials().add(passwordCredential);
       
        // Clear private state
        resourcePrincipalName = null;
View Full Code Here

        return resourcePrincipalName != null && userName != null && password != null;
    }

    public boolean commit() throws LoginException {
        subject.getPrincipals().add(new ResourcePrincipal(resourcePrincipalName));
        PasswordCredential passwordCredential = new PasswordCredential(userName, password);
        passwordCredential.setManagedConnectionFactory(passwordCredentialRealm.getManagedConnectionFactory());
        subject.getPrivateCredentials().add(passwordCredential);
        return true;
    }
View Full Code Here

        return resourcePrincipalName != null && userName != null && password != null;
    }

    public boolean commit() throws LoginException {
        subject.getPrincipals().add(new ResourcePrincipal(resourcePrincipalName));
        PasswordCredential passwordCredential = new PasswordCredential(userName, password);
        passwordCredential.setManagedConnectionFactory(passwordCredentialRealm.getManagedConnectionFactory());
        subject.getPrivateCredentials().add(passwordCredential);
        return true;
    }
View Full Code Here

    }

    public void testGetConnectionWithDudSubjectB() throws ResourceException {
        String user = new String("user");
        char password[] = {'a', 'b', 'c'};
        PasswordCredential creds = new PasswordCredential(user, password);
        subj.getPrivateCredentials().add(creds);
        Object o = mci.getConnection(subj, cri);

        verifyProxyInterceptors(o);
    }
View Full Code Here

TOP

Related Classes of javax.resource.spi.security.PasswordCredential

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.