Author: anil.saldhana(a)jboss.com
Date: 2012-02-02 16:57:08 -0500 (Thu, 02 Feb 2012)
New Revision: 1366
Modified:
product/branches/Branch_6_plus/picketlink-core/pom.xml
product/branches/Branch_6_plus/picketlink-core/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/SAML2STSLoginModule.java
product/branches/Branch_6_plus/picketlink-core/src/main/java/org/picketlink/trust/jbossws/handler/AbstractPicketLinkTrustHandler.java
product/branches/Branch_6_plus/picketlink-core/src/main/java/org/picketlink/trust/jbossws/handler/SecurityActions.java
product/branches/Branch_6_plus/picketlink-core/src/main/java/org/picketlink/trust/jbossws/handler/WSAuthenticationHandler.java
product/branches/Branch_6_plus/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/jboss/auth/SAML2STSLoginModuleUnitTestCase.java
product/branches/Branch_6_plus/picketlink-core/src/test/java/org/picketlink/test/trust/jbossws/jaas/SAMLRoleLoginModuleUnitTestCase.java
Log:
AS7/JBossWS changes
Modified: product/branches/Branch_6_plus/picketlink-core/pom.xml
===================================================================
--- product/branches/Branch_6_plus/picketlink-core/pom.xml 2012-02-02 14:29:48 UTC (rev
1365)
+++ product/branches/Branch_6_plus/picketlink-core/pom.xml 2012-02-02 21:57:08 UTC (rev
1366)
@@ -44,8 +44,8 @@
<dependencies>
<dependency>
<groupId>org.jboss.ws</groupId>
- <artifactId>jbossws-common</artifactId>
- <version>1.4.1.GA</version>
+ <artifactId>jbossws-spi</artifactId>
+ <version>2.0.1.GA</version>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
Modified:
product/branches/Branch_6_plus/picketlink-core/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/SAML2STSLoginModule.java
===================================================================
---
product/branches/Branch_6_plus/picketlink-core/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/SAML2STSLoginModule.java 2012-02-02
14:29:48 UTC (rev 1365)
+++
product/branches/Branch_6_plus/picketlink-core/src/main/java/org/picketlink/identity/federation/bindings/jboss/auth/SAML2STSLoginModule.java 2012-02-02
21:57:08 UTC (rev 1366)
@@ -524,10 +524,11 @@
protected boolean localValidation(Element assertionElement) throws Exception
{
- throw new RuntimeException(ErrorCodes.NOT_IMPLEMENTED_YET);
- /*//For unit tests
+ //For unit tests
if (localTestingOnly)
return true;
+ throw new RuntimeException(ErrorCodes.NOT_IMPLEMENTED_YET);
+ /*
try
{
Modified:
product/branches/Branch_6_plus/picketlink-core/src/main/java/org/picketlink/trust/jbossws/handler/AbstractPicketLinkTrustHandler.java
===================================================================
---
product/branches/Branch_6_plus/picketlink-core/src/main/java/org/picketlink/trust/jbossws/handler/AbstractPicketLinkTrustHandler.java 2012-02-02
14:29:48 UTC (rev 1365)
+++
product/branches/Branch_6_plus/picketlink-core/src/main/java/org/picketlink/trust/jbossws/handler/AbstractPicketLinkTrustHandler.java 2012-02-02
21:57:08 UTC (rev 1366)
@@ -36,7 +36,7 @@
import org.jboss.logging.Logger;
import org.jboss.security.AuthenticationManager;
import org.jboss.security.AuthorizationManager;
-import org.jboss.wsf.common.handler.GenericSOAPHandler;
+import org.jboss.ws.api.handler.GenericSOAPHandler;
import org.jboss.wsf.spi.SPIProvider;
import org.jboss.wsf.spi.SPIProviderResolver;
import org.jboss.wsf.spi.invocation.SecurityAdaptorFactory;
Modified:
product/branches/Branch_6_plus/picketlink-core/src/main/java/org/picketlink/trust/jbossws/handler/SecurityActions.java
===================================================================
---
product/branches/Branch_6_plus/picketlink-core/src/main/java/org/picketlink/trust/jbossws/handler/SecurityActions.java 2012-02-02
14:29:48 UTC (rev 1365)
+++
product/branches/Branch_6_plus/picketlink-core/src/main/java/org/picketlink/trust/jbossws/handler/SecurityActions.java 2012-02-02
21:57:08 UTC (rev 1366)
@@ -163,5 +163,18 @@
return theGroup;
}
});
- }
+ }
+
+ static void pushSecurityContext(final SecurityContext sc)
+ {
+ AccessController.doPrivileged(new PrivilegedAction<Void>()
+ {
+ @Override
+ public Void run()
+ {
+ SecurityContextAssociation.setSecurityContext(sc);
+ return null;
+ }
+ });
+ }
}
\ No newline at end of file
Modified:
product/branches/Branch_6_plus/picketlink-core/src/main/java/org/picketlink/trust/jbossws/handler/WSAuthenticationHandler.java
===================================================================
---
product/branches/Branch_6_plus/picketlink-core/src/main/java/org/picketlink/trust/jbossws/handler/WSAuthenticationHandler.java 2012-02-02
14:29:48 UTC (rev 1365)
+++
product/branches/Branch_6_plus/picketlink-core/src/main/java/org/picketlink/trust/jbossws/handler/WSAuthenticationHandler.java 2012-02-02
21:57:08 UTC (rev 1366)
@@ -27,6 +27,7 @@
import javax.xml.ws.handler.MessageContext;
import org.jboss.security.AuthenticationManager;
+import org.jboss.security.SecurityContext;
import org.jboss.wsf.spi.invocation.SecurityAdaptor;
import org.picketlink.identity.federation.core.ErrorCodes;
@@ -67,8 +68,8 @@
{
log.trace("Successfully Authenticated:Principal="+principal +
"::subject="+subject);
}
- securityAdaptor.pushSubjectContext(subject, principal, credential);
-
+ SecurityContext securityContext = SecurityActions.createSecurityContext(principal,
credential, subject);
+ SecurityActions.pushSecurityContext(securityContext);
return true;
}
}
\ No newline at end of file
Modified:
product/branches/Branch_6_plus/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/jboss/auth/SAML2STSLoginModuleUnitTestCase.java
===================================================================
---
product/branches/Branch_6_plus/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/jboss/auth/SAML2STSLoginModuleUnitTestCase.java 2012-02-02
14:29:48 UTC (rev 1365)
+++
product/branches/Branch_6_plus/picketlink-core/src/test/java/org/picketlink/test/identity/federation/bindings/jboss/auth/SAML2STSLoginModuleUnitTestCase.java 2012-02-02
21:57:08 UTC (rev 1366)
@@ -29,6 +29,7 @@
import java.security.acl.Group;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -42,6 +43,7 @@
import javax.security.auth.login.Configuration;
import javax.security.auth.login.LoginContext;
+import org.jboss.security.SecurityConstants;
import org.jboss.security.SimplePrincipal;
import org.jboss.security.auth.callback.ObjectCallback;
import org.junit.Before;
@@ -126,12 +128,24 @@
LoginContext lc = new LoginContext("something", subject, new MyCBH());
lc.login();
+ boolean handledOurRoles = false;
+
Set<Group> groups = subject.getPrincipals(Group.class);
assertNotNull(groups);
- assertEquals(1, groups.size());
- Group gp = groups.iterator().next();
- assertTrue(gp.isMember(new SimplePrincipal("test1")));
- assertTrue(gp.isMember(new SimplePrincipal("test2")));
- assertTrue(gp.isMember(new SimplePrincipal("testX")));
+ assertEquals(2, groups.size());
+ Iterator<Group> iter = groups.iterator();
+ while(iter.hasNext())
+ {
+ Group gp = iter.next();
+ if(gp.getName().equals(SecurityConstants.ROLES_IDENTIFIER))
+ {
+ assertTrue(gp.isMember(new SimplePrincipal("test1")));
+ assertTrue(gp.isMember(new SimplePrincipal("test2")));
+ assertTrue(gp.isMember(new SimplePrincipal("testX")));
+ handledOurRoles = true;
+ }
+ }
+
+ assertTrue("Handled our Roles", handledOurRoles);
}
}
\ No newline at end of file
Modified:
product/branches/Branch_6_plus/picketlink-core/src/test/java/org/picketlink/test/trust/jbossws/jaas/SAMLRoleLoginModuleUnitTestCase.java
===================================================================
---
product/branches/Branch_6_plus/picketlink-core/src/test/java/org/picketlink/test/trust/jbossws/jaas/SAMLRoleLoginModuleUnitTestCase.java 2012-02-02
14:29:48 UTC (rev 1365)
+++
product/branches/Branch_6_plus/picketlink-core/src/test/java/org/picketlink/test/trust/jbossws/jaas/SAMLRoleLoginModuleUnitTestCase.java 2012-02-02
21:57:08 UTC (rev 1366)
@@ -29,6 +29,7 @@
import java.security.acl.Group;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -42,6 +43,7 @@
import javax.security.auth.login.LoginException;
import javax.security.auth.spi.LoginModule;
+import org.jboss.security.SecurityConstants;
import org.jboss.security.SimplePrincipal;
import org.junit.Before;
import org.junit.Test;
@@ -148,12 +150,21 @@
LoginContext lc = new LoginContext("something", subject);
lc.login();
+boolean handledOurRoles = false;
Set<Group> groups = subject.getPrincipals(Group.class);
assertNotNull(groups);
- assertEquals(1, groups.size());
- Group gp = groups.iterator().next();
- assertTrue(gp.isMember(new SimplePrincipal("test1")));
- assertTrue(gp.isMember(new SimplePrincipal("test2")));
+ assertEquals(2, groups.size());
+ Iterator<Group> iter = groups.iterator();
+ while(iter.hasNext())
+ {
+ Group gp = iter.next();
+ if(gp.getName().equals(SecurityConstants.ROLES_IDENTIFIER))
+ {
+ assertTrue(gp.isMember(new SimplePrincipal("test1")));
+ assertTrue(gp.isMember(new SimplePrincipal("test2")));
+ handledOurRoles = true;
+ }
+ }
}
}
\ No newline at end of file
Show replies by date