aerospike-shiro-session

An implentation of a ShiroSessionDAO that uses and aerospike DB as the backing store

License

License

GroupId

GroupId

com.aerospike
ArtifactId

ArtifactId

aerospike-shiro-session
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

aerospike-shiro-session
An implentation of a ShiroSessionDAO that uses and aerospike DB as the backing store
Project URL

Project URL

http://github.com/aerospike/aerospike-shiro-session
Source Code Management

Source Code Management

https://github.com/aerospike/aerospike-shiro-session

Download aerospike-shiro-session

How to add to project

<!-- https://jarcasting.com/artifacts/com.aerospike/aerospike-shiro-session/ -->
<dependency>
    <groupId>com.aerospike</groupId>
    <artifactId>aerospike-shiro-session</artifactId>
    <version>1.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.aerospike/aerospike-shiro-session/
implementation 'com.aerospike:aerospike-shiro-session:1.0.2'
// https://jarcasting.com/artifacts/com.aerospike/aerospike-shiro-session/
implementation ("com.aerospike:aerospike-shiro-session:1.0.2")
'com.aerospike:aerospike-shiro-session:jar:1.0.2'
<dependency org="com.aerospike" name="aerospike-shiro-session" rev="1.0.2">
  <artifact name="aerospike-shiro-session" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.aerospike', module='aerospike-shiro-session', version='1.0.2')
)
libraryDependencies += "com.aerospike" % "aerospike-shiro-session" % "1.0.2"
[com.aerospike/aerospike-shiro-session "1.0.2"]

Dependencies

compile (2)

Group / Artifact Type Version
com.aerospike : aerospike-client jar 3.2.2
org.apache.shiro : shiro-all jar 1.2.4

Project Modules

There are no modules declared in this project.

Aerospike Shiro Session DAO Example

This project is an Aerospike implementation of a Shiro CachingSessionDAO to show how to use an Aerospike cluster for an enterprise session store across multiple Tomcat servers. It is based on the Shiro Web sample project.

Configuration

The configuration for the project is done via the shiro.ini file in the WebContent\WEB-INF folder. These are the configuration parameters:

# Aerospike Session DAO configuration
# Session timeout expressed in milliseconds
sessionDAO.globalSessionTimeout = 1800000

# Namespace to use for the session store
sessionDAO.namespace = test

# Setname to use for the session store
sessionDAO.setname = sessions

# Hostname for the Aerospike cluster
sessionDAO.hostname = localhost

# Port for the Aerospike cluster
sessionDAO.port = 3000

Building

This project requires gradle. After ensuring gradle has been installed, clone this repository and run gradle assemble from the command line. This will create an aerospike-shiro-session-1.0.war file in the build/libs directory.

Deploy

To deploy the project, copy the aerospike-shiro-session-1.0.war file from the build/libs directory to the webapps directory for your Apache Tomcat server. This project has been tested with Tomcat version 8.0.32. Note that Tomcat version 8.0.35 has this bug, so should be avoided.

Usage

To use the application, point your browser to http://localhost:8080/aerospike-shiro-session-1.0

Click on the Log in link and enter user for the username field and password for the pasword field on the log in form. You will be redirected to the accounts page. This page requies the user to be authenticated (see the [urls] section in the shiro.ini file).

Multiple Tomcat Servers

The configuration provided in this example does not use a session cache on the Tomcat server. This allows any Tomcat instance to serve the request as all servers will read/update the session information in the Aerospike DB. This means you do not need to configure "sticky sessions" on the load balancer.

To test this out, configure another Tomcat server and deploy the aerospike-shiro-session-1.0.war to that server. Now you can point a browser window to each of the Tomcat servers and try logging in/out from either Tomcat instance. Refreshing the other browser window will reflect the update as well.

com.aerospike

Aerospike

Versions

Version
1.0.2
1.0.1
1.0.0
0.0.1