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

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

Introduction

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

Prototype

public void setDefaultRoles(String defaultRoles) 

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);/*from w ww .  j  ava 2  s.  c o  m*/
    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);
}