AuthenticationHandlerBridge.java
2.66 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
67
68
69
70
71
72
73
74
75
76
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* javax.servlet.http.HttpServletRequest
* javax.servlet.http.HttpServletResponse
* org.apache.sling.auth.core.spi.AuthenticationHandler
* org.apache.sling.auth.core.spi.AuthenticationInfo
*/
package com.day.cq.compat.commonsauth.impl;
import com.day.cq.compat.commonsauth.impl.Bridge;
import java.io.IOException;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.sling.auth.core.spi.AuthenticationInfo;
import org.apache.sling.commons.auth.spi.AuthenticationHandler;
public class AuthenticationHandlerBridge
implements org.apache.sling.auth.core.spi.AuthenticationHandler,
Bridge {
private final AuthenticationHandler delegatee;
AuthenticationHandlerBridge(AuthenticationHandler delegatee) {
this.delegatee = delegatee;
}
public String getServiceName() {
return "org.apache.sling.auth.core.spi.AuthenticationHandler";
}
protected AuthenticationHandler getDelegatee() {
return this.delegatee;
}
public AuthenticationInfo extractCredentials(HttpServletRequest request, HttpServletResponse response) {
org.apache.sling.commons.auth.spi.AuthenticationInfo interimAuthInfo = this.getDelegatee().extractCredentials(request, response);
if (interimAuthInfo == null) {
return null;
}
if (interimAuthInfo == org.apache.sling.commons.auth.spi.AuthenticationInfo.DOING_AUTH) {
return AuthenticationInfo.DOING_AUTH;
}
if (interimAuthInfo == org.apache.sling.commons.auth.spi.AuthenticationInfo.FAIL_AUTH) {
return AuthenticationInfo.FAIL_AUTH;
}
AuthenticationInfo authInfo = new AuthenticationInfo(interimAuthInfo.getAuthType());
authInfo.putAll((Map)interimAuthInfo);
return authInfo;
}
public boolean requestCredentials(HttpServletRequest request, HttpServletResponse response) throws IOException {
return this.getDelegatee().requestCredentials(request, response);
}
public void dropCredentials(HttpServletRequest request, HttpServletResponse response) throws IOException {
this.getDelegatee().dropCredentials(request, response);
}
public boolean equals(Object obj) {
if (obj instanceof AuthenticationHandlerBridge) {
return this.getDelegatee() == ((AuthenticationHandlerBridge)obj).getDelegatee();
}
return false;
}
public int hashCode() {
return this.getDelegatee().hashCode();
}
public String toString() {
return "Bridged: " + this.getDelegatee().toString();
}
}