[jboss-cvs] Picketbox SVN: r499 - in trunk: security-spi/common and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jan 14 09:06:39 EST 2014


Author: sguilhen at redhat.com
Date: 2014-01-14 09:06:38 -0500 (Tue, 14 Jan 2014)
New Revision: 499

Modified:
   trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/auth/JASPIServerAuthenticationManager.java
   trunk/security-spi/common/common-spi.iml
   trunk/security-spi/spi/src/main/java/org/jboss/security/ServerAuthenticationManager.java
Log:
Add cleanSubject() to JASPIServerAuthenticationManager

Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/auth/JASPIServerAuthenticationManager.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/auth/JASPIServerAuthenticationManager.java	2014-01-10 08:44:33 UTC (rev 498)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/plugins/auth/JASPIServerAuthenticationManager.java	2014-01-14 14:06:38 UTC (rev 499)
@@ -174,5 +174,52 @@
           PicketBoxLogger.LOGGER.debugIgnoredException(ae);
       }
    }
+
+   public void cleanSubject(final MessageInfo messageInfo, final Subject subject, final String layer, final String appContext,
+                            final 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
+       {
+           serverConfig = provider.getServerAuthConfig(layer, appContext, handler);
+       }
+       catch (AuthException ae)
+       {
+           SecurityContextAssociation.getSecurityContext().getData().put(AuthException.class.getName(), ae);
+           PicketBoxLogger.LOGGER.errorGettingServerAuthConfig(layer, appContext, ae);
+           return;
+       }
+
+       String authContextId = serverConfig.getAuthContextID(messageInfo);
+       Properties properties = new Properties();
+       properties.setProperty("security-domain", super.getSecurityDomain());
+       Subject 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.cleanSubject(messageInfo, subject);
+       }
+       catch (AuthException ae)
+       {
+           SecurityContextAssociation.getSecurityContext().getData().put(AuthException.class.getName(), ae);
+           PicketBoxLogger.LOGGER.debugIgnoredException(ae);
+       }
+   }
    
 }
\ No newline at end of file

Modified: trunk/security-spi/common/common-spi.iml
===================================================================
--- trunk/security-spi/common/common-spi.iml	2014-01-10 08:44:33 UTC (rev 498)
+++ trunk/security-spi/common/common-spi.iml	2014-01-14 14:06:38 UTC (rev 499)
@@ -11,9 +11,18 @@
     </content>
     <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="library" name="Maven: system:jdk-tools:jdk" level="project" />
     <orderEntry type="library" scope="PROVIDED" name="Maven: org.jboss.logging:jboss-logging:3.1.0.GA" level="project" />
     <orderEntry type="library" scope="PROVIDED" name="Maven: org.jboss.logging:jboss-logging-processor:1.0.0.Final" level="project" />
-    <orderEntry type="library" name="Maven: system:jdk-tools:jdk" level="project" />
+    <orderEntry type="module-library">
+      <library name="Maven: system:jdk-tools:jdk">
+        <CLASSES>
+          <root url="jar:///usr/java/jdk1.7.0_45/lib/tools.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
   </component>
 </module>
 

Modified: trunk/security-spi/spi/src/main/java/org/jboss/security/ServerAuthenticationManager.java
===================================================================
--- trunk/security-spi/spi/src/main/java/org/jboss/security/ServerAuthenticationManager.java	2014-01-10 08:44:33 UTC (rev 498)
+++ trunk/security-spi/spi/src/main/java/org/jboss/security/ServerAuthenticationManager.java	2014-01-14 14:06:38 UTC (rev 499)
@@ -80,4 +80,19 @@
     */
    void secureResponse(MessageInfo messageInfo, Subject serviceSubject, String layer, String appContext, 
          CallbackHandler callbackHandler);
+
+    /**
+     * <p>
+     * Remove method specific principals and credentials from the subject.
+     * </p>
+     *
+     * @param messageInfo the object that contains the request and response messages.
+     * @param subject the subject to be cleaned.
+     * @param layer the message layer for JASPI.
+     * @param appContext the JASPI application context.
+     * @param handler the callback handler instance.
+     */
+   void cleanSubject(final MessageInfo messageInfo, final Subject subject, final String layer, final String appContext,
+                             final CallbackHandler handler);
+
 }
\ No newline at end of file



More information about the jboss-cvs-commits mailing list