Example usage for org.apache.shiro.cas CasRealm CasRealm

List of usage examples for org.apache.shiro.cas CasRealm CasRealm

Introduction

In this page you can find the example usage for org.apache.shiro.cas CasRealm CasRealm.

Prototype

public CasRealm() 

Source Link

Usage

From source file:org.everit.osgi.authentication.shiro.simple.CasRealmComponent.java

License:Open Source License

@Activate
public void activate(final BundleContext context, final Map<String, Object> componentProperties)
        throws Exception {
    String defaultRoles = getStringProperty(componentProperties, CasRealmConstants.PROP_DEFAULT_ROLES);
    String casServerUrlPrefix = getStringProperty(componentProperties,
            CasRealmConstants.PROP_CAS_SERVER_URL_PREFIX);
    String casService = getStringProperty(componentProperties, CasRealmConstants.PROP_CAS_SERVICE);

    CasRealm casRealm = new CasRealm();
    casRealm.setDefaultRoles(defaultRoles);
    casRealm.setCasServerUrlPrefix(casServerUrlPrefix);
    casRealm.setCasService(casService);/* w  ww  .  j  a  v  a 2s  . c  om*/
    Dictionary<String, Object> properties = new Hashtable<>();
    properties.put(CasRealmConstants.PROP_DEFAULT_ROLES, defaultRoles);
    properties.put(CasRealmConstants.PROP_CAS_SERVER_URL_PREFIX, casServerUrlPrefix);
    properties.put(CasRealmConstants.PROP_CAS_SERVICE, casService);
    properties.put("component.name", CasRealmConstants.COMPONENT_NAME);
    casRealmSR = context.registerService(Realm.class, casRealm, properties);
}