SlingAuthenticatorBridge.java
2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* javax.servlet.http.HttpServletRequest
* javax.servlet.http.HttpServletResponse
* org.apache.sling.api.auth.Authenticator
* org.apache.sling.api.auth.NoAuthenticationHandlerException
* org.apache.sling.auth.core.AuthenticationSupport
*/
package com.day.cq.compat.commonsauth.impl;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.sling.api.auth.Authenticator;
import org.apache.sling.commons.auth.AuthenticationSupport;
import org.apache.sling.commons.auth.NoAuthenticationHandlerException;
public class SlingAuthenticatorBridge
implements AuthenticationSupport,
org.apache.sling.commons.auth.Authenticator {
private org.apache.sling.auth.core.AuthenticationSupport slingAuthenticationSupport;
private Authenticator slingAuthenticator;
public boolean handleSecurity(HttpServletRequest request, HttpServletResponse response) {
boolean result = this.slingAuthenticationSupport.handleSecurity(request, response);
if (result) {
// empty if block
}
return true;
}
public void login(HttpServletRequest request, HttpServletResponse response) {
try {
this.slingAuthenticator.login(request, response);
}
catch (org.apache.sling.api.auth.NoAuthenticationHandlerException slingException) {
throw new NoAuthenticationHandlerException(slingException.getMessage(), slingException.getCause());
}
}
public void logout(HttpServletRequest request, HttpServletResponse response) {
this.slingAuthenticator.logout(request, response);
}
protected void bindSlingAuthenticationSupport(org.apache.sling.auth.core.AuthenticationSupport authenticationSupport) {
this.slingAuthenticationSupport = authenticationSupport;
}
protected void unbindSlingAuthenticationSupport(org.apache.sling.auth.core.AuthenticationSupport authenticationSupport) {
if (this.slingAuthenticationSupport == authenticationSupport) {
this.slingAuthenticationSupport = null;
}
}
protected void bindSlingAuthenticator(Authenticator authenticator) {
this.slingAuthenticator = authenticator;
}
protected void unbindSlingAuthenticator(Authenticator authenticator) {
if (this.slingAuthenticator == authenticator) {
this.slingAuthenticator = null;
}
}
}