Examples of PasswordCredential


Examples of javax.resource.spi.security.PasswordCredential

        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

Examples of javax.resource.spi.security.PasswordCredential

    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

Examples of javax.resource.spi.security.PasswordCredential

        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

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

Examples of javax.resource.spi.security.PasswordCredential

          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

Examples of javax.resource.spi.security.PasswordCredential

               // 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

Examples of javax.resource.spi.security.PasswordCredential

         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

Examples of javax.resource.spi.security.PasswordCredential

        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

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(managedConnectionFactory);
        subject.getPrivateCredentials().add(passwordCredential);
        return true;
    }
View Full Code Here

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(managedConnectionFactory);
        subject.getPrivateCredentials().add(passwordCredential);
        return true;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.