users@glassfish.java.net

Re: GF Bug? Getting empty credentials in JCA Adapter

From: <forums_at_java.net>
Date: Thu, 22 Dec 2011 16:51:40 -0600 (CST)

I'm fairly certain this is a glassfish bug... in ConnectionManagerImpl:
ResourceReferenceDescriptor ref = poolmgr.getResourceReference(jndiNameToUse,
logicalName); if (ref != null) { String shareableStr = ref.getSharingScope();
if (shareableStr.equals(ref.RESOURCE_UNSHAREABLE)) { resourceShareable =
false; } } //TODO V3 refactor all the 3 cases viz, no res-ref, app-auth,
cont-auth. if (ref == null) { if(getLogger().isLoggable(Level.FINE)) {
getLogger().log(Level.FINE, "poolmgr.no_resource_reference", jndiNameToUse);
} return internalGetConnection(mcf, defaultPrin, cxRequestInfo,
resourceShareable, jndiNameToUse, conn, true); } String auth =
ref.getAuthorization(); if
(auth.equals(ResourceReferenceDescriptor.APPLICATION_AUTHORIZATION)) { if
(cxRequestInfo == null) { String msg =
getLocalStrings().getString("con_mgr.null_userpass"); throw new
ResourceException(msg); }
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); } Notice how if a ResourceReferenceDescriptor
isn't found, it just automatically sends null for the principal.

--
[Message sent by forum member 'exabrial']
View Post: http://forums.java.net/node/876829