private ServiceRegistration registerLoginModuleFactory()

in src/main/java/org/apache/sling/auth/form/impl/jaas/JaasHelper.java [82:111]


    private ServiceRegistration<?> registerLoginModuleFactory(BundleContext ctx, FormAuthenticationHandlerConfig config) {
        ServiceRegistration<?> reg = null;
        try {
            Dictionary<String, Object> props = new Hashtable<>(); // NOSONARs
            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, config.jaas_ranking());
            props.put(LoginModuleFactory.JAAS_CONTROL_FLAG, config.jaas_controlFlag());
            props.put(LoginModuleFactory.JAAS_REALM_NAME, config.jaas_realmName());
            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) { // NOSONAR
            log.error("unable to create an register the SSO login module factory", e);
        }
        return reg;
    }