Package javax.resource.spi.security

Examples of javax.resource.spi.security.PasswordCredential


            if (info == null) {
                return null;
            } else {
                CciConnectionRequestInfo myinfo =
                    (CciConnectionRequestInfo) 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 CciManagedConnection
                (this, pc, xacon, con, true, true);
        } catch (SQLException ex) {
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 CciManagedConnection) {
View Full Code Here

       
        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 CciManagedConnection
                (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 CciManagedConnection) {
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 CciManagedConnection
                (this, pc, null, con, false, false);
        } 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 CciManagedConnection) {
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");
        }
View Full Code Here

    }
   
    try {
      if (userRole != null && rolePassword != null) {
        this.mappedRole = userRole;
        PasswordCredential cred = new PasswordCredential(userRole, decode(rolePassword));
        cred.setManagedConnectionFactory(getMcf());
        SecurityActions.addCredentials(this.subject, cred);   
      }
      return super.commit();
    } catch (Exception e) {
      throw new LoginException("Failed to decode password: "+e.getMessage()); //$NON-NLS-1$
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, false);
        } catch (SQLException ex) {
            ResourceException re =
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.