Cassandra Token Store for Spring Security OAuth2
Implementation of org.springframework.security.oauth2.provider.token.TokenStore backed by Cassandra (which can be executed on multi node cluster).
Implementation follows similar data model with org.springframework.security.oauth2.provider.token.store.redis.RedisTokenStore in persisting OAuth2 tokens in Cassandra.
CassandraTokenStore includes some enhancements on top of RedisTokenStore such as;
Dependencies listed below;
Implementation follows the same directory structure with token store examples provided by spring-security-oauth. You can simply configure the dependency and autowire CassandraTokenStore into AuthorizationServerEndpointsConfigurer.tokenStore(TokenStore)
dependencies {
compile "com.github.mert-z:spring-oauth2-cassandra-token-store:1.0"
}
@Configuration
public class AuthorizationServerConfiguration extends AuthorizationServerConfigurerAdapter {
@Autowired
private TokenStore cassandraTokenStore;
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
endpoints.tokenStore(tokenStore);
}
}
CassandraTokenStore is tested using spring-security-oauth2 token store tests.
CassandraTokenStoreTests initializes a test context which looks for connecting to an external standalone Cassandra instance listening connections on 127.0.0.1:9042.
CassandraTokenStoreTests can be executed as shown below;
./gradlew test --tests mertz.security.oauth2.provider.token.store.cassandra.CassandraTokenStoreTests
EmbeddedCassandraTokenStoreTests extends CassandraTokenStoreTests for providing a test context which starts an embedded Cassandra instance listening connections on 127.0.0.1:9142. Embedded Cassandra is provided by Spring for Cassandra unit.
EmbeddedCassandraTokenStoreTests can be executed as shown below;
./gradlew test --tests mertz.security.oauth2.provider.token.store.cassandra.EmbeddedCassandraTokenStoreTests
This project is licensed under the MIT License - see the LICENSE.md file for details