FlexClientResponseHelper.java
2.4 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
77
78
79
80
81
82
83
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* javax.servlet.http.HttpServletResponse
* org.slf4j.Logger
* org.slf4j.LoggerFactory
*/
package com.day.crx.security.token.impl;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/*
* This class specifies class file version 49.0 but uses Java 6 signatures. Assumed Java 6.
*/
class FlexClientResponseHelper {
private static final Logger log = LoggerFactory.getLogger(FlexClientResponseHelper.class);
public static final String PAR_J_FLEX = "j_flex";
public static final String PAR_J_LOGOUT = "logout";
public static final String RES_AUTHENTICATED = "authenticated";
public static final String RES_AUTHSTATE = "authstate";
public static final String RES_AUTHTYPE = "authtype";
public static final String RES_USERID = "userid";
public static final String RES_REASON = "reason";
FlexClientResponseHelper() {
}
public static void writeResponse(HttpServletResponse response, Map<String, String> responseContent) {
StringBuilder sb = new StringBuilder();
for (Map.Entry<String, String> e : responseContent.entrySet()) {
sb.append(e.getKey()).append('=').append(e.getValue()).append('&');
}
if (sb.length() != 0) {
sb.deleteCharAt(sb.length() - 1);
}
try {
response.setStatus(200);
response.setContentType("text/plain");
response.setCharacterEncoding("ISO-8859-1");
PrintWriter pw = response.getWriter();
pw.write(sb.toString());
response.flushBuffer();
}
catch (IOException ioe) {
log.error("Failed to send response", (Throwable)ioe);
}
}
/*
* This class specifies class file version 49.0 but uses Java 6 signatures. Assumed Java 6.
*/
static enum AuthFailedReason {
TOKEN_EXPIRED,
WRONG_CREDENTIALS;
private AuthFailedReason() {
}
}
/*
* This class specifies class file version 49.0 but uses Java 6 signatures. Assumed Java 6.
*/
static enum AuthState {
FAILED,
COMPLETE,
LOGGED_OUT,
CREDENTIAL_CHALLENGE;
private AuthState() {
}
}
}