[jboss-cvs] Picketbox SVN: r474 - in branches/eap62: security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/auth and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Oct 23 13:18:50 EDT 2013
Author: pskopek at redhat.com
Date: 2013-10-23 13:18:50 -0400 (Wed, 23 Oct 2013)
New Revision: 474
Modified:
branches/eap62/
branches/eap62/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/auth/JASPIServerAuthenticationManager.java
branches/eap62/security-spi/common/src/main/java/org/jboss/security/PicketBoxLogger.java
Log:
SECURITY-759 Configuration problems that can result in an AuthException when getting the ServerAuthConfig or ServerAuthContext are now logged at ERROR level
- merged
Property changes on: branches/eap62
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/4.0.16.Final_BZ_901138:413
/branches/embargo/4.0.14.Final-JBPAPP6-1704:377
/branches/embargo/4.0.16.Final-vault:408-449
/tags/4.0.16.Final:393-407
/trunk:458,462-463
+ /branches/4.0.16.Final_BZ_901138:413
/branches/embargo/4.0.14.Final-JBPAPP6-1704:377
/branches/embargo/4.0.16.Final-vault:408-449
/tags/4.0.16.Final:393-407
/trunk:458,462-464
Modified: branches/eap62/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/auth/JASPIServerAuthenticationManager.java
===================================================================
--- branches/eap62/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/auth/JASPIServerAuthenticationManager.java 2013-10-23 17:08:40 UTC (rev 473)
+++ branches/eap62/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/auth/JASPIServerAuthenticationManager.java 2013-10-23 17:18:50 UTC (rev 474)
@@ -72,26 +72,47 @@
public boolean isValid(MessageInfo messageInfo, Subject clientSubject, String layer, String appContext,
CallbackHandler callbackHandler)
{
- AuthStatus status = AuthStatus.FAILURE;
-
+
+ AuthConfigFactory factory = AuthConfigFactory.getFactory();
+ AuthConfigProvider provider = factory.getConfigProvider(layer,appContext,null);
+ if(provider == null)
+ throw PicketBoxMessages.MESSAGES.invalidNullAuthConfigProviderForLayer(layer, appContext);
+
+ ServerAuthConfig serverConfig = null;
try
{
- AuthConfigFactory factory = AuthConfigFactory.getFactory();
- AuthConfigProvider provider = factory.getConfigProvider(layer,appContext,null);
- if(provider == null)
- throw PicketBoxMessages.MESSAGES.invalidNullAuthConfigProviderForLayer(layer, appContext);
+ serverConfig = provider.getServerAuthConfig(layer,appContext,callbackHandler);
+ }
+ catch (AuthException ae)
+ {
+ SecurityContextAssociation.getSecurityContext().getData().put(AuthException.class.getName(), ae);
+ PicketBoxLogger.LOGGER.errorGettingServerAuthConfig(layer, appContext, ae);
+ return false;
+ }
+ String authContextId = serverConfig.getAuthContextID(messageInfo);
+ Properties properties = new Properties();
+ properties.setProperty("security-domain", super.getSecurityDomain());
- ServerAuthConfig serverConfig = provider.getServerAuthConfig(layer,appContext,callbackHandler);
- String authContextId = serverConfig.getAuthContextID(messageInfo);
+ ServerAuthContext sctx = null;
+ try
+ {
+ sctx = serverConfig.getAuthContext(authContextId, new Subject(), properties);
+ }
+ catch (AuthException ae)
+ {
+ SecurityContextAssociation.getSecurityContext().getData().put(AuthException.class.getName(), ae);
+ PicketBoxLogger.LOGGER.errorGettingServerAuthContext(authContextId, super.getSecurityDomain(), ae);
+ return false;
+ }
- Properties properties = new Properties();
- properties.setProperty("security-domain", super.getSecurityDomain());
- ServerAuthContext sctx = serverConfig.getAuthContext(authContextId, new Subject(), properties);
-
- if(clientSubject == null)
- clientSubject = new Subject();
- Subject serviceSubject = new Subject();
- status = sctx.validateRequest(messageInfo, clientSubject, serviceSubject);
+ if(clientSubject == null)
+ clientSubject = new Subject();
+ Subject serviceSubject = new Subject();
+
+ AuthStatus status = AuthStatus.FAILURE;
+ try
+ {
+ status = sctx.validateRequest(messageInfo, clientSubject, serviceSubject);
//TODO: Add caching
}
catch(AuthException ae)
@@ -109,23 +130,44 @@
public void secureResponse(MessageInfo messageInfo, Subject serviceSubject, String layer, String appContext,
CallbackHandler handler)
{
+ AuthConfigFactory factory = AuthConfigFactory.getFactory();
+ AuthConfigProvider provider = factory.getConfigProvider(layer, appContext, null);
+ if(provider == null)
+ throw PicketBoxMessages.MESSAGES.invalidNullAuthConfigProviderForLayer(layer, appContext);
+
+ ServerAuthConfig serverConfig = null;
try
{
- AuthConfigFactory factory = AuthConfigFactory.getFactory();
- AuthConfigProvider provider = factory.getConfigProvider(layer, appContext, null);
- if(provider == null)
- throw PicketBoxMessages.MESSAGES.invalidNullAuthConfigProviderForLayer(layer, appContext);
+ serverConfig = provider.getServerAuthConfig(layer, appContext, handler);
+ }
+ catch (AuthException ae)
+ {
+ SecurityContextAssociation.getSecurityContext().getData().put(AuthException.class.getName(), ae);
+ PicketBoxLogger.LOGGER.errorGettingServerAuthConfig(layer, appContext, ae);
+ return;
+ }
- ServerAuthConfig serverConfig = provider.getServerAuthConfig(layer, appContext, handler);
- String authContextId = serverConfig.getAuthContextID(messageInfo);
-
- Properties properties = new Properties();
- properties.setProperty("security-domain", super.getSecurityDomain());
- if (serviceSubject == null)
- serviceSubject = new Subject();
- ServerAuthContext sctx = serverConfig.getAuthContext(authContextId, serviceSubject, properties);
- sctx.secureResponse(messageInfo, serviceSubject);
+ String authContextId = serverConfig.getAuthContextID(messageInfo);
+ Properties properties = new Properties();
+ properties.setProperty("security-domain", super.getSecurityDomain());
+ if (serviceSubject == null)
+ serviceSubject = new Subject();
+ ServerAuthContext sctx = null;
+ try
+ {
+ sctx = serverConfig.getAuthContext(authContextId, serviceSubject, properties);
}
+ catch (AuthException ae)
+ {
+ SecurityContextAssociation.getSecurityContext().getData().put(AuthException.class.getName(), ae);
+ PicketBoxLogger.LOGGER.errorGettingServerAuthContext(authContextId, super.getSecurityDomain(), ae);
+ return;
+ }
+
+ try
+ {
+ sctx.secureResponse(messageInfo, serviceSubject);
+ }
catch(AuthException ae)
{
SecurityContextAssociation.getSecurityContext().getData().put(AuthException.class.getName(), ae);
Modified: branches/eap62/security-spi/common/src/main/java/org/jboss/security/PicketBoxLogger.java
===================================================================
--- branches/eap62/security-spi/common/src/main/java/org/jboss/security/PicketBoxLogger.java 2013-10-23 17:08:40 UTC (rev 473)
+++ branches/eap62/security-spi/common/src/main/java/org/jboss/security/PicketBoxLogger.java 2013-10-23 17:18:50 UTC (rev 474)
@@ -712,4 +712,11 @@
@Message(id = 372, value = "Security Vault key store successfuly converted to JCEKS type (%s). From now on use JCEKS as KEYSTORE_TYPE in Security Vault configuration.")
void keyStoreConvertedToJCEKS(String keyStoreFile);
+ @LogMessage(level = Logger.Level.ERROR)
+ @Message(id = 373, value = "Error getting ServerAuthConfig for layer %s and appContext %s")
+ void errorGettingServerAuthConfig(String layer, String appContext, @Cause Throwable cause);
+
+ @LogMessage(level = Logger.Level.ERROR)
+ @Message(id = 374, value = "Error getting ServerAuthContext for authContextId %s and security domain %s")
+ void errorGettingServerAuthContext(String authContextId, String securityDomain, @Cause Throwable cause);
}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list