Git Product home page Git Product logo

mongo-realm's Introduction

MongoDB-backed realm for Glassfish

With Mongo-Realm you can store your users credentials directly in MongoDB with other data of your applicaton. Forget about setting up separate MySQL or LDAP server only for storing users data.

Setup

  1. download mongo-realm jar and put it in your glassfish domains lib folder (i.e. $GLASSFISH_HOME/glassfish/domains/$DOMAINNAME/lib/)
  2. at the end of $GLASSFISH_HOME/glassfish/domains/$DOMAINNAME/config/login.conf file paste:
mongoRealm { 
  com.tadamski.glassfish.mongo.realm.MongoLoginModule required; 
};
  1. create realm in glassfish using asadmin tool
asadmin create-auth-realm --classname com.tadamski.glassfish.mongo.realm.MongoRealm --property jaas-context=mongoRealm $REALM_NAME
  1. configure your applicaton to use newly created realm (in most cases few lines in web.xml will be enough)

Configuration

By default:

Mongo-Realm connects to localhost on 27017 and looks for data in users database in users collection. Informations about users are stored in separate documents [one user = one document]. Each document contains login, password simple string properties and groups with array of group names user belongs to. All passwords are hashed using SHA-512 function.

Salt property is appended to the password before hashing. For users without salt, it will be generated on the first login.

For MongoDB CR authentication use properties mongo.login and mongo.password. Empty login means no authentication.

Custom configuration:

Of course defaults can be overriden. Simply add properties to realm created in 3rd step of Setup.

Property name Default value
mongo.hostname localhost
mongo.port 27017
mongo.login
mongo.password
mongo.db.name users
mongo.collection.name users
login.property login
salt.property salt
password.property password
groups.property groups
hash.function SHA-512

mongo-realm's People

Contributors

krchniam avatar satellite13 avatar tmszdmsk avatar

Watchers

 avatar

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.