Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
IsurangaPerera committed May 12, 2017
1 parent 1a0e3d7 commit 945f484
Show file tree
Hide file tree
Showing 16 changed files with 2,549 additions and 93 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
identity-inbound-auth-sts.iml
.idea
org.wso2.carbon.sts/org.wso2.carbon.sts.iml
org.wso2.carbon.sts/org.wso2.carbon.sts.iml
.gitignore
.project
.settings
26 changes: 26 additions & 0 deletions org.wso2.carbon.sts.store/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
26 changes: 26 additions & 0 deletions org.wso2.carbon.sts.store/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.wso2.carbon</groupId>
<artifactId>identity-inbound-auth-sts</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>org.wso2.carbon.sts.store</groupId>
<artifactId>org.wso2.carbon.sts.store</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>org.wso2.carbon.sts.store</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package org.wso2.carbon.sts.store;

public class DBQueries {

public static final String ADD_TOKEN = "INSERT INTO IDN_STS_STORE (TOKEN_ID, TOKEN_CONTENT,CREATE_DATE," +
" EXPIRE_DATE,STATE) VALUES (?,?,?,?,?)";

public static final String UPDATE_TOKEN = "UPDATE IDN_STS_STORE SET TOKEN_CONTENT = ? ,CREATE_DATE = ?," +
"EXPIRE_DATE = ?, STATE = ? WHERE TOKEN_ID = ?";

public static final String REMOVE_TOKEN = "DELETE FROM IDN_STS_STORE WHERE TOKEN_ID = ?";

public static final String ALL_TOKEN_KEYS = "SELECT TOKEN_ID FROM IDN_STS_STORE";

public static final String GET_TOKEN = "SELECT TOKEN_CONTENT FROM IDN_STS_STORE WHERE TOKEN_ID = ?";

public static final String GET_ALL_TOKENS = "SELECT * FROM IDN_STS_STORE";

public static final String VALID_TOKENS = "SELECT * FROM IDN_STS_STORE WHERE STATE =? OR STATE =?";

public static final String GET_TOKENS_BY_STATE = "SELECT * FROM IDN_STS_STORE WHERE STATE = ?";

public static final String TOKENS_EXISTS = "SELECT 1 FROM IDN_STS_STORE";

private DBQueries() {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.wso2.carbon.sts.store;

public class STSMgtConstants {

public static final String TOKEN_CACHE_MANAGER = "STS_TOKEN_CACHE_MANAGER";
public static final String TOKEN_CACHE_ID = "STS_TOKEN_CACHE";

public static final String TOKEN_CONTENT = "TOKEN_CONTENT";
public static final String TOKEN_ID = "TOKEN_ID";

private STSMgtConstants() {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
package org.wso2.carbon.sts.store;

import java.io.Serializable;
import java.util.Date;
import java.util.Properties;

public class SerializableToken implements Serializable {

private static final long serialVersionUID = 1101734842629522246L;

private String id;
private int state;
private String token;
private String previousToken;
private String attachedReference;
private String unattachedReference;
private java.util.Properties properties;
private boolean changed;
private byte[] secret;
private Date created;
private Date expires;
private String issuerAddress;
private boolean persistenceEnabled;

public int getState() {
return state;
}

public void setState(int state) {
this.state = state;
}

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

public String getToken() {
return token;
}

public void setToken(String token) {
this.token = token;
}

public String getPreviousToken() {
return previousToken;
}

public void setPreviousToken(String previousToken) {
this.previousToken = previousToken;
}

public String getAttachedReference() {
return attachedReference;
}

public void setAttachedReference(String attachedReference) {
this.attachedReference = attachedReference;
}

public String getUnattachedReference() {
return unattachedReference;
}

public void setUnattachedReference(String unattachedReference) {
this.unattachedReference = unattachedReference;
}

public Properties getProperties() {
return properties;
}

public void setProperties(Properties properties) {
this.properties = properties;
}

public boolean isChanged() {
return changed;
}

public void setChanged(boolean changed) {
this.changed = changed;
}

public byte[] getSecret() {
return secret;
}

public void setSecret(byte[] secret) {
this.secret = secret;
}

public Date getCreated() {
return created;
}

public void setCreated(Date created) {
this.created = created;
}

public Date getExpires() {
return expires;
}

public void setExpires(Date expires) {
this.expires = expires;
}

public String getIssuerAddress() {
return issuerAddress;
}

public void setIssuerAddress(String issuerAddress) {
this.issuerAddress = issuerAddress;
}

public boolean isPersistenceEnabled() {
return persistenceEnabled;
}

public void setPersistenceEnabled(boolean persistenceEnabled) {
this.persistenceEnabled = persistenceEnabled;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package org.wso2.carbon.sts.store;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}

/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}

/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
10 changes: 10 additions & 0 deletions org.wso2.carbon.sts/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/test/java" output="target/test-classes" including="**/*.java"/>
<classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
<classpathentry kind="src" path="src/main/java" including="**/*.java"/>
<classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
<classpathentry kind="src" path="target/maven-shared-archive-resources" excluding="**/*.java"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
</classpath>
Loading

0 comments on commit 945f484

Please sign in to comment.