AuthenticationInfoPostProcessorBridge.java
2.75 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
/*
* 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.AuthenticationInfo
* org.apache.sling.auth.core.spi.AuthenticationInfoPostProcessor
*/
package com.day.cq.compat.commonsauth.impl;
import com.day.cq.compat.commonsauth.impl.Bridge;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.sling.auth.core.spi.AuthenticationInfoPostProcessor;
import org.apache.sling.commons.auth.spi.AuthenticationInfo;
/*
* This class specifies class file version 49.0 but uses Java 6 signatures. Assumed Java 6.
*/
public class AuthenticationInfoPostProcessorBridge
implements AuthenticationInfoPostProcessor,
Bridge {
private final org.apache.sling.commons.auth.spi.AuthenticationInfoPostProcessor delegatee;
AuthenticationInfoPostProcessorBridge(org.apache.sling.commons.auth.spi.AuthenticationInfoPostProcessor delegatee) {
this.delegatee = delegatee;
}
@Override
public String getServiceName() {
return "org.apache.sling.auth.core.spi.AuthenticationInfoPostProcessor";
}
public void postProcess(org.apache.sling.auth.core.spi.AuthenticationInfo info, HttpServletRequest request, HttpServletResponse response) {
AuthenticationInfo interimAuthInfo = new AuthenticationInfo(info.getAuthType());
this.putAllButAuthType((HashMap<String, Object>)info, interimAuthInfo);
this.delegatee.postProcess(interimAuthInfo, request, response);
this.clearAllButAuthType((HashMap<String, Object>)info);
this.putAllButAuthType(interimAuthInfo, (HashMap<String, Object>)info);
}
public boolean equals(Object obj) {
if (obj instanceof AuthenticationInfoPostProcessorBridge) {
return this.delegatee == ((AuthenticationInfoPostProcessorBridge)obj).delegatee;
}
return false;
}
public int hashCode() {
return this.delegatee.hashCode();
}
private void putAllButAuthType(HashMap<String, Object> source, HashMap<String, Object> destination) {
for (Map.Entry<String, Object> entry : source.entrySet()) {
String key = entry.getKey();
if ("sling.authType".equals(key)) continue;
destination.put(key, entry.getValue());
}
}
private void clearAllButAuthType(HashMap<String, Object> map) {
Iterator<String> iterator = map.keySet().iterator();
while (iterator.hasNext()) {
String key = iterator.next();
if ("sling.authType".equals(key)) continue;
iterator.remove();
}
}
}