|
|
|
|
1 |
|
/*
|
|
|
|
|
2 |
|
* License
d to the A
pache Soft
ware Found
ation (ASF
) under on
e or more
|
|
|
|
|
3 |
|
* contrib
utor licen
se agreeme
nts. See
the NOTICE
file dist
ributed wi
th
|
|
|
|
|
4 |
|
* this wo
rk for add
itional in
formation
regarding
copyright
ownership.
|
|
|
|
|
5 |
|
* The ASF
licenses
this file
to You und
er the Apa
che Licens
e, Version
2.0
|
|
|
|
|
6 |
|
* (the "L
icense");
you may no
t use this
file exce
pt in comp
liance wit
h
|
|
|
|
|
7 |
|
* the Lic
ense. You
may obtai
n a copy o
f the Lice
nse at
|
|
|
|
|
8 |
|
*
|
|
|
|
|
9 |
|
* ht
tp://www.a
pache.org/
licenses/L
ICENSE-2.0
|
|
|
|
|
10 |
|
*
|
|
|
|
|
11 |
|
* Unless
required b
y applicab
le law or
agreed to
in writing
, software
|
|
|
|
|
12 |
|
* distrib
uted under
the Licen
se is dist
ributed on
an "AS IS
" BASIS,
|
|
|
|
|
13 |
|
* WITHOUT
WARRANTIE
S OR CONDI
TIONS OF A
NY KIND, e
ither expr
ess or imp
lied.
|
|
|
|
|
14 |
|
* See the
License f
or the spe
cific lang
uage gover
ning permi
ssions and
|
|
|
|
|
15 |
|
* limitat
ions under
the Licen
se.
|
|
|
|
|
16 |
|
*/
|
|
|
|
|
17 |
|
package or
g.apache.c
atalina.au
thenticato
r.jaspic;
|
|
|
|
|
18 |
|
|
|
|
|
|
19 |
|
import jav
a.util.Has
hMap;
|
|
|
|
|
20 |
|
import jav
a.util.Map
;
|
|
|
|
|
21 |
|
|
|
|
|
|
22 |
|
import jav
ax.securit
y.auth.mes
sage.Messa
geInfo;
|
|
|
|
|
23 |
|
import jav
ax.servlet
.http.Http
ServletReq
uest;
|
|
|
|
|
24 |
|
import jav
ax.servlet
.http.Http
ServletRes
ponse;
|
|
|
|
|
25 |
|
|
|
|
|
|
26 |
|
import org
.apache.to
mcat.util.
res.String
Manager;
|
|
|
|
|
27 |
|
|
|
|
|
|
28 |
|
public cla
ss Message
InfoImpl i
mplements
MessageInf
o {
|
|
|
|
|
29 |
|
protec
ted static
final Str
ingManager
sm = Stri
ngManager.
getManager
(MessageIn
foImpl.cla
ss);
|
|
|
|
|
30 |
|
|
|
|
|
|
31 |
|
public
static fi
nal String
IS_MANDAT
ORY = "jav
ax.securit
y.auth.mes
sage.Messa
gePolicy.i
sMandatory
";
|
|
|
|
|
32 |
|
|
|
|
|
|
33 |
|
privat
e final Ma
p<String,
Object> ma
p = new Ha
shMap<>();
|
|
|
|
|
34 |
|
privat
e HttpServ
letRequest
request;
|
|
|
|
|
35 |
|
privat
e HttpServ
letRespons
e response
;
|
|
|
|
|
36 |
|
|
|
|
|
|
37 |
|
public
MessageIn
foImpl() {
|
|
|
|
|
38 |
|
}
|
|
|
|
|
39 |
|
|
|
|
|
|
40 |
|
public
MessageIn
foImpl(Htt
pServletRe
quest requ
est, HttpS
ervletResp
onse respo
nse, boole
an authMan
datory) {
|
|
|
|
|
41 |
|
th
is.request
= request
;
|
|
|
|
|
42 |
|
th
is.respons
e = respon
se;
|
|
|
|
|
43 |
|
ma
p.put(IS_M
ANDATORY,
Boolean.to
String(aut
hMandatory
));
|
|
|
|
|
44 |
|
}
|
|
|
|
|
45 |
|
|
|
|
|
|
46 |
|
@Overr
ide
|
|
|
|
|
47 |
|
@Suppr
essWarning
s("rawtype
s")
|
|
|
|
|
48 |
|
// JAS
PIC uses r
aw types
|
|
|
|
|
49 |
|
public
Map getMa
p() {
|
|
|
|
|
50 |
|
re
turn map;
|
|
|
|
|
51 |
|
}
|
|
|
|
|
52 |
|
|
|
|
|
|
53 |
|
@Overr
ide
|
|
|
|
|
54 |
|
public
Object ge
tRequestMe
ssage() {
|
|
|
|
|
55 |
|
re
turn reque
st;
|
|
|
|
|
56 |
|
}
|
|
|
|
|
57 |
|
|
|
|
|
|
58 |
|
@Overr
ide
|
|
|
|
|
59 |
|
public
Object ge
tResponseM
essage() {
|
|
|
|
|
60 |
|
re
turn respo
nse;
|
|
|
|
|
61 |
|
}
|
|
|
|
|
62 |
|
|
|
|
|
|
63 |
|
@Overr
ide
|
|
|
|
|
64 |
|
public
void setR
equestMess
age(Object
request)
{
|
|
|
|
|
65 |
|
if
(!(reques
t instance
of HttpSer
vletReques
t)) {
|
|
|
|
|
66 |
|
throw ne
w IllegalA
rgumentExc
eption(sm.
getString(
"authentic
ator.jaspi
c.badReque
stType",
|
|
|
|
|
67 |
|
request.ge
tClass().g
etName()))
;
|
|
|
|
|
68 |
|
}
|
|
|
|
|
69 |
|
th
is.request
= (HttpSe
rvletReque
st) reques
t;
|
|
|
|
|
70 |
|
}
|
|
|
|
|
71 |
|
|
|
|
|
|
72 |
|
@Overr
ide
|
|
|
|
|
73 |
|
public
void setR
esponseMes
sage(Objec
t response
) {
|
|
|
|
|
74 |
|
if
(!(respon
se instanc
eof HttpSe
rvletRespo
nse)) {
|
|
|
|
|
75 |
|
throw ne
w IllegalA
rgumentExc
eption(sm.
getString(
"authentic
ator.jaspi
c.badRespo
nseType",
|
|
|
|
|
76 |
|
response.g
etClass().
getName())
);
|
|
|
|
|
77 |
|
}
|
|
|
|
|
78 |
|
th
is.respons
e = (HttpS
ervletResp
onse) resp
onse;
|
|
|
|
|
79 |
|
}
|
|
|
|
|
80 |
|
}
|