WSO2 UserManager 0.6, Guide to using User Manager

[Download] | [Documentation Home] | [Release Note]

Table of Contents

Overview of UserManager

WSO2 UserManager uses Realms to connect to user stores. For example org.wso2.usermanager.custom.jdbc.JDBCRealm can connect to relational databases to authenticate users. Following is the list of Realms with their speciality. All Realms implement the org.wso2.usermanager.Realm interface. Therefore your application can switch back and forth between Realms.

Realm NameDescription
JDBCRealmAuthenticate users in relational databases
LDAPRealmAuthenticate users in company LDAP to Authenticate users
AcegiRealmAuthenticate users in Acegi user stores
DefaultRealmCreate/manage/querry users. The database can be created using the scripts provided or by calling utility methods.
AuthorizingRealmThis realm wraps other realms. It calls isUserAuthorized() method before performing actions.

Coding with UserManager

Using the Realm interface is accompanied by 5 other interfaces. Using the Realm interface we can get objects that implement these interfaces. They can manipute or read UserStore.

getAuthorizer()
InterfaceRealm Interface MethodDescription
org.wso2.usermanager.AuthenticatorgetAuthenticator()Authenticate users.
org.wso2.usermanager.AccessControlAdmingetAccessControlAdmin()Add/edit/delete Authorization on users/roles/resources
org.wso2.usermanager.AuthorizerCan check for authorizations
org.wso2.usermanager.UserStoreAdmingetUserStoreAdmin()Add/edit/delete users.
org.wso2.usermanager.UserStoreReadergetUserStoreReader()Querry user details.

This is how you initialize and use the realm.

        Realm realm = new XYZRealm();
        XYZRealmConfig config = (XYZRealmConfig) realm
                .getRealmConfiguration();
	/*Call setter methods on the configuration object*/
        config.set.......
        config.set.......
	realm.init(config);
	realm.getAuthenticator().authenticate("anne", "annepass");
	

For more details on configuration baen parameters please refer Configuration Manual

Compiling with UserManager

You only need the usermanager-core.jar and usemanager-config.jar. Other libraries depends on the type of Realm that you are using.

Realm NameRequired Additional Libraries
JDBCRealmOnly the jar containing the JDBC driver of your choice
LDAPRealm naming-factory.jar, naming-factory-dbcp.jar, naming-resources.jar
AcegiRealmspring.jar, acegi-security.jar
DefaultRealmOnly the jar containing the JDBC driver of your choice
AuthorizingRealm - None -

Connecting to Existing User Stores

When connecting to existing user stores you only perform Authentication. The following realms are the Realms that you can use for this purpose

Creating your own User Stores

When your application wants to create and maintain users in your own database Default Realm can be used. It is a fully pleged Realm where users/roles and permissions can be created/managed and querried.

Using a AuthorizingRealm

AuthorizingRealm wraps another Realm inside it along with a username. Before calling the actions it calls isUserAuthorized() method for the authenticated user.