Skip to content

Instantly share code, notes, and snippets.

@anilsaldhana
Last active December 20, 2015 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anilsaldhana/70b61759143f2fd134dc to your computer and use it in GitHub Desktop.
Save anilsaldhana/70b61759143f2fd134dc to your computer and use it in GitHub Desktop.
Here I describe the changes I made to test https://issues.jboss.org/browse/PLINK2-101 functionality.
======================
TESTING
======================
1. Downloaded EAP 6.1 from jboss.org
2. Downloaded PicketLink quickstarts. I only used employee.war and idp.war Removed all other archives.
3. Downloaded Apache Derby. I used Apache Derby as a Network Server to test the Database functionality.
4. Accessed http://localhost:8080/employee/ there was sign in via the IDP and back.
=======================
JBOSS EAP 6.1
=======================
JBoss EAP 6.1 downloaded from jboss.org
Replaced PicketLink libraries with 2.1.8 ones
~/jboss-eap-6.1/modules/system/layers/base/org/picketlink/main$ cp ~/picketlink2/federation/picketlink-core/target/picketlink-core-2.1.8-SNAPSHOT.jar .
~/jboss-eap-6.1/modules/system/layers/base/org/picketlink/main$ cp ~/picketlink2/federation/picketlink-bindings/build-jbas7/target/picketlink-jbas7-2.1.8-SNAPSHOT.jar .
standalone/configuration/standalone.xml
-----------------------------------------
<datasource jndi-name="java:jboss/datasources/picketlink-sts" pool-name="derbyDS" enabled="true" use-java-context="true">
<driver-class>org.apache.derby.jdbc.ClientDriver</driver-class>
<connection-url>jdbc:derby://localhost:1527/picketlinksts;create=true</connection-url>
<driver>org.apache.derby</driver>
<pool>
<min-pool-size>5</min-pool-size>
<max-pool-size>20</max-pool-size>
</pool>
<timeout>
<idle-timeout-minutes>5</idle-timeout-minutes>
</timeout>
<statement>
<track-statements>true</track-statements>
</statement>
<!--
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
-->
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="org.apache.derby" module="org.apache.derby">
<xa-datasource-class>org.apache.derby.jdbc.ClientXADataSource</xa-datasource-class>
</driver>
</drivers>
====================================
CHANGES MADE TO IDP Web Application
====================================
WEB-INF/web.xml
---------------
Added the following block toward the end.
<resource-ref>
<res-ref-name>jdbc/picketlink-sts</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</web-app>
WEB-INF/jboss-web.xml
----------------------
<resource-ref>
<res-ref-name>jdbc/picketlink-sts</res-ref-name>
<jndi-name>java:jboss/datasources/picketlink-sts</jndi-name>
</resource-ref>
</jboss-web>
WEB-INF/picketlink.xml
------------------------
<TokenProvider ProviderClass="org.picketlink.identity.federation.core.saml.v2.providers.SAML20AssertionTokenProvider"
TokenType="urn:oasis:names:tc:SAML:2.0:assertion"
TokenElement="Assertion" TokenElementNS="urn:oasis:names:tc:SAML:2.0:assertion" >
<Property Key="RevocationRegistry" Value="JDBC" />
<Property Key="TokenRegistry" Value="JDBC"/>
</TokenProvider>
</TokenProviders>
META-INF/jboss-deployment-structure.xml
------------------------------------------
<deployment>
<!-- Add picketlink module dependency -->
<dependencies>
<module name="org.picketlink" />
<module name="org.apache.derby" />
</dependencies>
</deployment>
You can see that I added a module dependency for Apache Derby.
=============================================
CREATED MODULE FOR APACHE DERBY
=============================================
I created a module for Apache Derby as follows
~jboss-eap-6.1/modules/system/layers/base/org/apache/derby/main
module.xml
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="org.apache.derby">
<resources>
<resource-root path="derbyclient.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
~/jboss-eap-6.1/modules/system/layers/base/org/apache/derby/main$ ls
derbyclient.jar module.xml
=========================
Dealing with Apache Derby
==========================
Downloaded the latest Apache Derby as a lib distribution. I am using Derby as a network server.
1. Start Apache Derby as a Network Server
~/apache-derby/db-derby-10.10.1.1-lib/lib$ java -jar derbyrun.jar server start
Tue Aug 06 16:24:42 CDT 2013 : Security manager installed using the Basic server security policy.
Tue Aug 06 16:24:43 CDT 2013 : Apache Derby Network Server - 10.10.1.1 - (1458268) started and ready to accept connections on port 1527
2. In another window, we can create a database as well as tables
~/apache-derby/db-derby-10.10.1.1-lib/lib$ java -classpath derbytools.jar:derby.jar:derbyclient.jar org.apache.derby.tools.ij
le> connect 'jdbc:derby://localhost:1527/picketlinksts;create=true';
ij> create table TOKEN_REGISTRY(TOKEN_ID VARCHAR(40), TOKEN VARCHAR(5000), CREATED_DATE TIMESTAMP);
0 rows inserted/updated/deleted
> create table REVOCATION_REGISTRY(TOKEN_ID VARCHAR(40), TOKEN_TYPE VARCHAR(50), CREATED_DATE TIMESTAMP);
0 rows inserted/updated/deleted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment