Author: anil.saldhana(a)jboss.com
Date: 2011-09-15 01:47:43 -0400 (Thu, 15 Sep 2011)
New Revision: 1223
Removed:
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/ClassLoadingSecurityActions.java
Modified:
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/PicketLinkAuthenticator.java
Log:
PLFED-229: PicketLink Authenticator has issues due to custom username that does not
change
Deleted:
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/ClassLoadingSecurityActions.java
===================================================================
---
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/ClassLoadingSecurityActions.java 2011-09-14
20:10:47 UTC (rev 1222)
+++
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/ClassLoadingSecurityActions.java 2011-09-15
05:47:43 UTC (rev 1223)
@@ -1,72 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.picketlink.identity.federation.bindings.tomcat;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * Privileged Blocks for loading classes
- * Redundant class added to some environment
- * with PL1 and PL2 versions of code base
- * @author Anil.Saldhana(a)redhat.com
- * @since Sep 14, 2011
- */
-class ClassLoadingSecurityActions
-{
- static Class<?> loadClass(final Class<?> theClass, final String fqn)
- {
- return AccessController.doPrivileged(new PrivilegedAction<Class<?>>()
- {
- public Class<?> run()
- {
- ClassLoader classLoader = theClass.getClassLoader();
-
- Class<?> clazz = loadClass(classLoader, fqn);
- if (clazz == null)
- {
- classLoader = Thread.currentThread().getContextClassLoader();
- clazz = loadClass(classLoader, fqn);
- }
- return clazz;
- }
- });
- }
-
- static Class<?> loadClass(final ClassLoader cl, final String fqn)
- {
- return AccessController.doPrivileged(new PrivilegedAction<Class<?>>()
- {
- public Class<?> run()
- {
- try
- {
- return cl.loadClass(fqn);
- }
- catch (ClassNotFoundException e)
- {
- }
- return null;
- }
- });
- }
-}
\ No newline at end of file
Modified:
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/PicketLinkAuthenticator.java
===================================================================
---
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/PicketLinkAuthenticator.java 2011-09-14
20:10:47 UTC (rev 1222)
+++
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/PicketLinkAuthenticator.java 2011-09-15
05:47:43 UTC (rev 1223)
@@ -22,7 +22,9 @@
package org.picketlink.identity.federation.bindings.tomcat;
import java.io.IOException;
+import java.security.AccessController;
import java.security.Principal;
+import java.security.PrivilegedAction;
import java.util.Set;
import java.util.UUID;
@@ -156,7 +158,7 @@
{
if (subjectInteraction == null)
{
- Class<?> clazz = ClassLoadingSecurityActions.loadClass(getClass(),
subjectInteractionClassName);
+ Class<?> clazz = loadClass(getClass(), subjectInteractionClassName);
try
{
subjectInteraction = (SubjectSecurityInteraction) clazz.newInstance();
@@ -178,4 +180,41 @@
}
return null;
}
+
+ Class<?> loadClass(final Class<?> theClass, final String fqn)
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<Class<?>>()
+ {
+ public Class<?> run()
+ {
+ ClassLoader classLoader = theClass.getClassLoader();
+
+ Class<?> clazz = loadClass(classLoader, fqn);
+ if (clazz == null)
+ {
+ classLoader = Thread.currentThread().getContextClassLoader();
+ clazz = loadClass(classLoader, fqn);
+ }
+ return clazz;
+ }
+ });
+ }
+
+ Class<?> loadClass(final ClassLoader cl, final String fqn)
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<Class<?>>()
+ {
+ public Class<?> run()
+ {
+ try
+ {
+ return cl.loadClass(fqn);
+ }
+ catch (ClassNotFoundException e)
+ {
+ }
+ return null;
+ }
+ });
+ }
}
\ No newline at end of file