Package com.sun.enterprise.deployment

Examples of com.sun.enterprise.deployment.ResourcePrincipal


                e.initCause(re);
                throw e;
            }
        }

        ResourcePrincipal resourcePrincipal = null;
        if (principal == null) {
            try {
                resourcePrincipal = getDefaultResourcePrincipal(poolInfo, mcf);
            } catch (NamingException ne) {
                _logger.log(Level.WARNING, "jdbc.pool_not_reachable", ne.getMessage());
View Full Code Here


                userName = ConnectionPoolObjectsUtils.getValueFromMCF("User", poolInfo, mcf);
            }
            password = ConnectionPoolObjectsUtils.getValueFromMCF("Password", poolInfo, mcf);
        }
        //Now return the ResourcePrincipal
        return new ResourcePrincipal(userName, password);
    }
View Full Code Here

                        createManagedConnectionFactory(connectorConnectionPool, loader);
                if (mcf != null) {
                    //validate MCF before it is used or related pooling infrastructure is created.
                    validateMCF(mcf, activeResourceAdapter.getModuleName());

                    ResourcePrincipal prin =
                            getDefaultResourcePrincipal(poolInfo, mcf, env);
                    Subject s = ConnectionPoolObjectsUtils.createSubject(mcf, prin);
                    int txSupport = connectorConnectionPool.getTransactionSupport();

                    //JSR-322 : check the runtime transaction level support of MCF and use appropriately.
View Full Code Here

            //From what we have seen so far, the user cannot be null
            //but password can be
            //if user is null we will use default authentication
            //TODO: Discuss if this is the right thing to do
            ResourcePrincipal prin = (user == null) ?
                    null : new ResourcePrincipal(user, passwd);
            con = (java.sql.Connection) getUnpooledConnection(poolInfo, prin, true);
            if (con == null) {
                String i18nMsg = localStrings.getString(
                        "ccp_adm.null_unpooled_connection");
                throw new SQLException(i18nMsg);
View Full Code Here

            }
            ConnectorRuntime.getRuntime().switchOnMatching(rarName, poolInfo);
            return internalGetConnection(mcf, null, cxRequestInfo,
                    resourceShareable, jndiNameToUse, conn, false);
        } else {
            ResourcePrincipal prin = null;
            Set principalSet = null;
            Principal callerPrincipal = null;
            SecurityContext securityContext = null;
            ConnectorRuntime connectorRuntime = ConnectorRuntime.getRuntime();
            //TODO V3 is SecurityContext.getCurrent() the right way ? Does it need to be injected ?
            if (connectorRuntime.isServer() &&
                    (securityContext = SecurityContext.getCurrent()) != null &&
                    (callerPrincipal = securityContext.getCallerPrincipal()) != null &&
                    (principalSet = securityContext.getPrincipalSet()) != null) {
                AuthenticationService authService =
                        connectorRuntime.getAuthenticationService(rarName, poolInfo);
                if (authService != null) {
                    prin = (ResourcePrincipal) authService.mapPrincipal(
                            callerPrincipal, principalSet);
                }
            }

            if (prin == null) {
                prin = ref.getResourcePrincipal();
                if (prin == null) {
                    if (getLogger().isLoggable(Level.FINE)) {
                        getLogger().log(Level.FINE, "default-resource-principal not"
                                + "specified for " + jndiNameToUse + ". Defaulting to"
                                + " user/password specified in the pool");
                    }
                    prin = defaultPrin;
                } else if (!prin.equals(defaultPrin)) {
                    ConnectorRuntime.getRuntime().switchOnMatching(rarName, poolInfo);
                }
            }
            return internalGetConnection(mcf, prin, cxRequestInfo,
                    resourceShareable, jndiNameToUse, conn, false);
View Full Code Here

    /**
     * notification of the end of XML parsing for this node
     */
    public void postParsing() {  
        if (getParentNode().getDescriptor() instanceof ResourceReferenceDescriptor) {
            ((ResourceReferenceDescriptor) getParentNode().getDescriptor()).setResourcePrincipal(new ResourcePrincipal(name, passwd));
        } else {
            getParentNode().addDescriptor(new ResourcePrincipal(name, passwd));
        }
    }
View Full Code Here

                        crt.obtainManagedConnectionFactory(poolInfo);
                Subject subject = new Subject();
                PasswordCredential pc = new PasswordCredential(
                        dbUser, dbPassword.toCharArray());
                pc.setManagedConnectionFactory(fac);
                Principal prin = new ResourcePrincipal(dbUser, dbPassword);
                subject.getPrincipals().add(prin);
                subject.getPrivateCredentials().add(pc);
                ManagedConnection mc = fac.createManagedConnection(subject, null);
                connList.add(mc);
                try {
View Full Code Here

        HashMap userMap = new HashMap();
        HashMap groupMap = new HashMap();
        // Add user-backendPrincipal mappings to Map1
        for (ConnectorSecurityMap map : securityMaps) {
            ResourcePrincipal principal = generateResourcePrincipal(map);

            List<String> principalNames = map.getPrincipals();
            for (String principalName : principalNames) {
                userMap.put(principalName, principal);
            }
View Full Code Here

            ConnectorSecurityMap securityMap) {

        EisBackendPrincipal backendPrincipal = securityMap.getBackendPrincipal();
        String userName = backendPrincipal.getUserName();
        String password = backendPrincipal.getPassword();
        return new ResourcePrincipal(userName, password);
    }
View Full Code Here

     * @return
     * @throws javax.resource.ResourceException
     */
    protected Subject getDefaultSubject(PoolInfo poolInfo, ManagedConnectionFactory mcf,
            ResourcePrincipal prin) throws ResourceException {
        ResourcePrincipal resourcePrincipal = null;
        if (prin == null) {
            try {
                resourcePrincipal = getDefaultResourcePrincipal(poolInfo, mcf);
            } catch (NamingException ne) {
                _logger.log(Level.WARNING, "jdbc.pool_not_reachable",
View Full Code Here

TOP

Related Classes of com.sun.enterprise.deployment.ResourcePrincipal

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.