public class OJDBCTokenRegistry extends AbstractJDBCRegistry implements SecurityTokenRegistry
SecurityTokenRegistry
using JDBC
This is a working implementation implementation based on the plink JDBCTokenRegistry which allows better jndi configuration (eg
global datasources under JBAS 7+ -- https://docs.jboss.org/author/display/AS71/JNDI+Reference) and serialization to blob fields
for Oracle (and other DBs) Initial implementation used a varchar for the serialized class.
This implementation uses a new set of tables..
Oracle Create Table
ALTER TABLE STS_TOKEN_REGISTRY DROP PRIMARY KEY CASCADE; DROP TABLE STS_TOKEN_REGISTRY CASCADE CONSTRAINTS; CREATE TABLE STS_TOKEN_REGISTRY( TOKEN_ID VARCHAR2(1024) NOT NULL, CREATED_DATE TIMESTAMP(6) WITH TIME ZONE NOT NULL, TOKEN BLOB NOT NULL ); CREATE UNIQUE INDEX STS_TOKEN_REGISTRY_PK ON STS_TOKEN_REGISTRY (TOKEN_ID); ALTER TABLE STS_TOKEN_REGISTRY ADD ( CONSTRAINT STS_TOKEN_REGISTRY_PK PRIMARY KEY (TOKEN_ID) USING INDEX STS_TOKEN_REGISTRY_PK );Picketlink.xml condfiguration:
<TokenProvider ... > ... <Property Key="TokenRegistry" Value="OJDBC"/> <Property Key="TokenRegistryJDBCNameSpace" Value="java:jboss" /> <!-- default value is java:jboss and can be ommited --> <Property Key="TokenRegistryJDBCDataSource" Value="jdbc/picketlink-sts" /> <!-- default value is jdbc/picketlink-sts and can be ommited --> ... </TokenProvider>
dataSource, logger
Constructor and Description |
---|
OJDBCTokenRegistry() |
OJDBCTokenRegistry(String jndiName) |
OJDBCTokenRegistry(String initial,
String jndiName) |
Modifier and Type | Method and Description |
---|---|
void |
addToken(String tokenID,
Object token)
Add a token to the registry with the given id
|
Object |
getToken(String tokenID)
Given the id, return a token
|
void |
removeToken(String tokenID)
Remove a token given the ID
|
safeClose
public OJDBCTokenRegistry()
public OJDBCTokenRegistry(String jndiName)
public void addToken(String tokenID, Object token) throws IOException
SecurityTokenRegistry
addToken
in interface SecurityTokenRegistry
IOException
SecurityTokenRegistry.addToken(String, Object)
public void removeToken(String tokenID) throws IOException
SecurityTokenRegistry
removeToken
in interface SecurityTokenRegistry
IOException
SecurityTokenRegistry.removeToken(String)
public Object getToken(String tokenID)
SecurityTokenRegistry
getToken
in interface SecurityTokenRegistry
SecurityTokenRegistry.getToken(String)
Copyright © 2019. All rights reserved.