Package javax.resource.spi.security

Examples of javax.resource.spi.security.PasswordCredential


            matchManagedConnections(Set connectionSet,
                                    Subject subject,
                                    ConnectionRequestInfo info)
        throws ResourceException {

        PasswordCredential pc =
            Util.getPasswordCredential(this, subject, info);
        Iterator it = connectionSet.iterator();
        while (it.hasNext()) {
            Object obj = it.next();
            if (obj instanceof JdbcManagedConnection) {
View Full Code Here


            if (info == null) {
                return null;
            } else {
                JdbcConnectionRequestInfo myinfo =
                    (JdbcConnectionRequestInfo) info;
                PasswordCredential pc =
                    new PasswordCredential(myinfo.getUser(),
                                           myinfo.getPassword().toCharArray());
                pc.setManagedConnectionFactory(mcf);
                return pc;
            }
        } else {
            PasswordCredential pc =
            (PasswordCredential) AccessController.doPrivileged
                (new PrivilegedAction() {
                    public Object run() {
                        Set creds = subject.getPrivateCredentials
                            (PasswordCredential.class);
                        Iterator iter = creds.iterator();
                        while (iter.hasNext()) {
                            PasswordCredential temp =
                                (PasswordCredential) iter.next();
                            if (temp.getManagedConnectionFactory().
                                equals(mcf)) {
                                return temp;
                            }
                        }
                        return null;
View Full Code Here

        throws ResourceException {
       
        try {
            XAConnection xacon = null;
            String userName = null;
            PasswordCredential pc =
                Util.getPasswordCredential(this, subject, info);
            if (pc == null) {
                xacon = getXADataSource().getXAConnection();
            } else {
                userName = pc.getUserName();
                xacon = getXADataSource().
                    getXAConnection(userName,
                                    new String(pc.getPassword()));
            }
            Connection con = xacon.getConnection();
            return new JdbcManagedConnection
                (this, pc, xacon, con, true, true);
        } catch (SQLException ex) {
View Full Code Here

    public Object getConnection(Subject subject,
                                ConnectionRequestInfo connectionRequestInfo)
        throws ResourceException {

        PasswordCredential pc =
            Util.getPasswordCredential(mcf, subject, connectionRequestInfo);
        if (!Util.isPasswordCredentialEqual(pc, passCred)) {
            throw new SecurityException("Principal does not match. Reauthentication not supported");
        }
        checkIfDestroyed();
View Full Code Here

        throws ResourceException {
       
        try {
            Connection con = null;
            String userName = null;
            PasswordCredential pc =
                Util.getPasswordCredential(this, subject, info);
            if (pc == null) {
                con = DriverManager.getConnection(url);
            } else {
                userName = pc.getUserName();
                con = DriverManager.getConnection
                    (url, userName, new String(pc.getPassword()));
            }
            return new JdbcManagedConnection
                (this, pc, null, con, false, true);
        } catch (SQLException ex) {
            ResourceException re =
View Full Code Here

            matchManagedConnections(Set connectionSet,
                                    Subject subject,
                                    ConnectionRequestInfo info)
        throws ResourceException {

        PasswordCredential pc =
            Util.getPasswordCredential(this, subject, info);
        Iterator it = connectionSet.iterator();
        while (it.hasNext()) {
            Object obj = it.next();
            if (obj instanceof JdbcManagedConnection) {
View Full Code Here

          bc.pwd = ((BlasterConnectionRequestInfo)info).getPassword();
       } else if (subject != null) {
          // Credentials from appserver
          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;
             }
          }
          if(pwdc != null) {
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
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

        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

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.