use of org.apache.felix.jaas.LoginModuleFactory in project jackrabbit-oak by apache.
the class ExternalLoginModuleFactoryTest method setUpJaasFactoryWithInjection.
/**
* Prepares the OSGi part with required services injected and configures
* the factory in JAAS options which then delegates to ExternalLoginModuleFactory
*/
private void setUpJaasFactoryWithInjection() throws Exception {
context.registerService(Repository.class, EasyMock.createMock(Repository.class));
context.registerService(SyncManager.class, new SyncManagerImpl(whiteboard));
context.registerService(ExternalIdentityProviderManager.class, new ExternalIDPManagerImpl(whiteboard));
final LoginModuleFactory lmf = context.registerInjectActivateService(new ExternalLoginModuleFactory());
options.put(ProxyLoginModule.PROP_LOGIN_MODULE_FACTORY, new ProxyLoginModule.BootLoginModuleFactory() {
@Override
public LoginModule createLoginModule() {
return lmf.createLoginModule();
}
});
}
use of org.apache.felix.jaas.LoginModuleFactory in project sling by apache.
the class JaasHelper method registerLoginModuleFactory.
private ServiceRegistration registerLoginModuleFactory(BundleContext ctx, Dictionary properties) {
ServiceRegistration reg = null;
try {
java.util.Properties props = new java.util.Properties();
final String desc = "LoginModule Support for FormAuthenticationHandler";
props.put(Constants.SERVICE_DESCRIPTION, desc);
props.put(Constants.SERVICE_VENDOR, ctx.getBundle().getHeaders().get(Constants.BUNDLE_VENDOR));
props.put(LoginModuleFactory.JAAS_RANKING, properties.get(LoginModuleFactory.JAAS_RANKING));
props.put(LoginModuleFactory.JAAS_CONTROL_FLAG, properties.get(LoginModuleFactory.JAAS_CONTROL_FLAG));
props.put(LoginModuleFactory.JAAS_REALM_NAME, properties.get(LoginModuleFactory.JAAS_REALM_NAME));
reg = ctx.registerService(LoginModuleFactory.class.getName(), new LoginModuleFactory() {
public LoginModule createLoginModule() {
return new FormLoginModule(authHandler);
}
@Override
public String toString() {
return desc + " (" + FormLoginModule.class.getName() + ")";
}
}, props);
log.info("Registered FormLoginModuleFactory");
} catch (Throwable e) {
log.error("unable to create an register the SSO login module factory", e);
}
return reg;
}
Aggregations