Skip to content

Instantly share code, notes, and snippets.

@yupadhyay
Created March 25, 2015 17:21
Show Gist options
  • Save yupadhyay/184a4fb965151fc06252 to your computer and use it in GitHub Desktop.
Save yupadhyay/184a4fb965151fc06252 to your computer and use it in GitHub Desktop.
//Import
import org.osgi.framework.ServiceRegistration;
import org.apache.sling.auth.core.spi.AuthenticationHandler;
import org.apache.sling.auth.core.spi.DefaultAuthenticationFeedbackHandler;
//Your Custom Auth handler class
public class CustomAuthHandler extends DefaultAuthenticationFeedbackHandler implements AuthenticationHandler {
//All Your Logic
private ServiceRegistration loginModule;
//All Your Logic
@Activate
protected void activate(ComponentContext componentContext) {
context = componentContext;
this.loginModule = null;
try {
this.loginModule = CustomPluggableLoginModule.register(this, componentContext.getBundleContext());
} catch (Throwable t) {
//Error handling
}
}
@Deactivate
protected void deactivate(@SuppressWarnings("unused") ComponentContext componentContext) {
if (loginModule != null) {
loginModule.unregister();
loginModule = null;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment