GithubHelp home page GithubHelp logo

aerospike-shiro-session's Introduction

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.