|   | 
  | 
  | 
  | 
1 | 
  | 
/**
 | 
|   | 
  | 
  | 
  | 
2 | 
  | 
 *  Licens
ed to the 
Apache Sof
tware Foun
dation (AS
F) under o
ne or more
 | 
|   | 
  | 
  | 
  | 
3 | 
  | 
 *  contri
butor lice
nse agreem
ents.  See
 the NOTIC
E file dis
tributed w
ith
 | 
|   | 
  | 
  | 
  | 
4 | 
  | 
 *  this w
ork for ad
ditional i
nformation
 regarding
 copyright
 ownership
.
 | 
|   | 
  | 
  | 
  | 
5 | 
  | 
 *  The AS
F licenses
 this file
 to You un
der the Ap
ache Licen
se, Versio
n 2.0
 | 
|   | 
  | 
  | 
  | 
6 | 
  | 
 *  (the "
License");
 you may n
ot use thi
s file exc
ept in com
pliance wi
th
 | 
|   | 
  | 
  | 
  | 
7 | 
  | 
 *  the Li
cense.  Yo
u may obta
in a copy 
of the Lic
ense at
 | 
|   | 
  | 
  | 
  | 
8 | 
  | 
 *
 | 
|   | 
  | 
  | 
  | 
9 | 
  | 
 *     htt
p://www.ap
ache.org/l
icenses/LI
CENSE-2.0
 | 
|   | 
  | 
  | 
  | 
10 | 
  | 
 *
 | 
|   | 
  | 
  | 
  | 
11 | 
  | 
 *  Unless
 required 
by applica
ble law or
 agreed to
 in writin
g, softwar
e
 | 
|   | 
  | 
  | 
  | 
12 | 
  | 
 *  distri
buted unde
r the Lice
nse is dis
tributed o
n an "AS I
S" BASIS,
 | 
|   | 
  | 
  | 
  | 
13 | 
  | 
 *  WITHOU
T WARRANTI
ES OR COND
ITIONS OF 
ANY KIND, 
either exp
ress or im
plied.
 | 
|   | 
  | 
  | 
  | 
14 | 
  | 
 *  See th
e License 
for the sp
ecific lan
guage gove
rning perm
issions an
d
 | 
|   | 
  | 
  | 
  | 
15 | 
  | 
 *  limita
tions unde
r the Lice
nse.
 | 
|   | 
  | 
  | 
  | 
16 | 
  | 
 */
 | 
|   | 
  | 
  | 
  | 
17 | 
  | 
package or
g.apache.c
atalina.au
thenticato
r.jaspic;
 | 
|   | 
  | 
  | 
  | 
18 | 
  | 
 | 
|   | 
  | 
  | 
  | 
19 | 
  | 
import jav
a.util.Map
;
 | 
|   | 
  | 
  | 
  | 
20 | 
  | 
 | 
|   | 
  | 
  | 
  | 
21 | 
  | 
import jav
ax.securit
y.auth.cal
lback.Call
backHandle
r;
 | 
|   | 
  | 
  | 
  | 
22 | 
  | 
import jav
ax.securit
y.auth.mes
sage.AuthE
xception;
 | 
|   | 
  | 
  | 
  | 
23 | 
  | 
import jav
ax.securit
y.auth.mes
sage.confi
g.AuthConf
igFactory;
 | 
|   | 
  | 
  | 
  | 
24 | 
  | 
import jav
ax.securit
y.auth.mes
sage.confi
g.AuthConf
igProvider
;
 | 
|   | 
  | 
  | 
  | 
25 | 
  | 
import jav
ax.securit
y.auth.mes
sage.confi
g.ClientAu
thConfig;
 | 
|   | 
  | 
  | 
  | 
26 | 
  | 
import jav
ax.securit
y.auth.mes
sage.confi
g.ServerAu
thConfig;
 | 
|   | 
  | 
  | 
  | 
27 | 
  | 
 | 
|   | 
  | 
  | 
  | 
28 | 
  | 
/**
 | 
|   | 
  | 
  | 
  | 
29 | 
  | 
 * Basic i
mplementat
ion primar
ily intend
ed for use
 when usin
g third-pa
rty
 | 
|   | 
  | 
  | 
  | 
30 | 
  | 
 * {@link 
javax.secu
rity.auth.
message.mo
dule.Serve
rAuthModul
e} impleme
ntations
 | 
|   | 
  | 
  | 
  | 
31 | 
  | 
 * that on
ly provide
 the modul
e.
 | 
|   | 
  | 
  | 
  | 
32 | 
  | 
 */
 | 
|   | 
  | 
  | 
  | 
33 | 
  | 
public cla
ss SimpleA
uthConfigP
rovider im
plements A
uthConfigP
rovider {
 | 
|   | 
  | 
  | 
  | 
34 | 
  | 
 | 
|   | 
  | 
  | 
  | 
35 | 
  | 
    privat
e final Ma
p<String,S
tring> pro
perties;
 | 
|   | 
  | 
  | 
  | 
36 | 
  | 
 | 
|   | 
  | 
  | 
  | 
37 | 
  | 
    privat
e volatile
 ServerAut
hConfig se
rverAuthCo
nfig;
 | 
|   | 
  | 
  | 
  | 
38 | 
  | 
 | 
|   | 
  | 
  | 
  | 
39 | 
  | 
    public
 SimpleAut
hConfigPro
vider(Map<
String,Str
ing> prope
rties, Aut
hConfigFac
tory facto
ry) {
 | 
|   | 
  | 
  | 
  | 
40 | 
  | 
        th
is.propert
ies = prop
erties;
 | 
|   | 
  | 
  | 
  | 
41 | 
  | 
        if
 (factory 
!= null) {
 | 
|   | 
  | 
  | 
  | 
42 | 
  | 
          
  factory.
registerCo
nfigProvid
er(this, n
ull, null,
 "Automati
c registra
tion");
 | 
|   | 
  | 
  | 
  | 
43 | 
  | 
        }
 | 
|   | 
  | 
  | 
  | 
44 | 
  | 
    }
 | 
|   | 
  | 
  | 
  | 
45 | 
  | 
 | 
|   | 
  | 
  | 
  | 
46 | 
  | 
 | 
|   | 
  | 
  | 
  | 
47 | 
  | 
    /**
 | 
|   | 
  | 
  | 
  | 
48 | 
  | 
     * {@i
nheritDoc}
 | 
|   | 
  | 
  | 
  | 
49 | 
  | 
     * <p>
 | 
|   | 
  | 
  | 
  | 
50 | 
  | 
     * Thi
s implemen
tation doe
s not supp
ort client
-side auth
entication
 and
 | 
|   | 
  | 
  | 
  | 
51 | 
  | 
     * the
refore alw
ays return
s {@code n
ull}.
 | 
|   | 
  | 
  | 
  | 
52 | 
  | 
     */
 | 
|   | 
  | 
  | 
  | 
53 | 
  | 
    @Overr
ide
 | 
|   | 
  | 
  | 
  | 
54 | 
  | 
    public
 ClientAut
hConfig ge
tClientAut
hConfig(St
ring layer
, String a
ppContext,
 | 
|   | 
  | 
  | 
  | 
55 | 
  | 
          
  Callback
Handler ha
ndler) thr
ows AuthEx
ception {
 | 
|   | 
  | 
  | 
  | 
56 | 
  | 
        re
turn null;
 | 
|   | 
  | 
  | 
  | 
57 | 
  | 
    }
 | 
|   | 
  | 
  | 
  | 
58 | 
  | 
 | 
|   | 
  | 
  | 
  | 
59 | 
  | 
 | 
|   | 
  | 
  | 
  | 
60 | 
  | 
    @Overr
ide
 | 
|   | 
  | 
  | 
  | 
61 | 
  | 
    public
 ServerAut
hConfig ge
tServerAut
hConfig(St
ring layer
, String a
ppContext,
 | 
|   | 
  | 
  | 
  | 
62 | 
  | 
          
  Callback
Handler ha
ndler) thr
ows AuthEx
ception {
 | 
|   | 
  | 
  | 
  | 
63 | 
  | 
        Se
rverAuthCo
nfig serve
rAuthConfi
g = this.s
erverAuthC
onfig;
 | 
|   | 
  | 
  | 
  | 
64 | 
  | 
        if
 (serverAu
thConfig =
= null) {
 | 
|   | 
  | 
  | 
  | 
65 | 
  | 
          
  synchron
ized (this
) {
 | 
|   | 
  | 
  | 
  | 
66 | 
  | 
          
      if (
this.serve
rAuthConfi
g == null)
 {
 | 
|   | 
  | 
  | 
  | 
67 | 
  | 
          
          
this.serve
rAuthConfi
g = create
ServerAuth
Config(lay
er, appCon
text, hand
ler, prope
rties);
 | 
|   | 
  | 
  | 
  | 
68 | 
  | 
          
      }
 | 
|   | 
  | 
  | 
  | 
69 | 
  | 
          
      serv
erAuthConf
ig = this.
serverAuth
Config;
 | 
|   | 
  | 
  | 
  | 
70 | 
  | 
          
  }
 | 
|   | 
  | 
  | 
  | 
71 | 
  | 
        }
 | 
|   | 
  | 
  | 
  | 
72 | 
  | 
        re
turn serve
rAuthConfi
g;
 | 
|   | 
  | 
  | 
  | 
73 | 
  | 
    }
 | 
|   | 
  | 
  | 
  | 
74 | 
  | 
 | 
|   | 
  | 
  | 
  | 
75 | 
  | 
 | 
|   | 
  | 
  | 
  | 
76 | 
  | 
    protec
ted Server
AuthConfig
 createSer
verAuthCon
fig(String
 layer, St
ring appCo
ntext,
 | 
|   | 
  | 
  | 
  | 
77 | 
  | 
          
  Callback
Handler ha
ndler, Map
<String,St
ring> prop
erties) {
 | 
|   | 
  | 
  | 
  | 
78 | 
  | 
        re
turn new S
impleServe
rAuthConfi
g(layer, a
ppContext,
 handler, 
properties
);
 | 
|   | 
  | 
  | 
  | 
79 | 
  | 
    }
 | 
|   | 
  | 
  | 
  | 
80 | 
  | 
 | 
|   | 
  | 
  | 
  | 
81 | 
  | 
 | 
|   | 
  | 
  | 
  | 
82 | 
  | 
    @Overr
ide
 | 
|   | 
  | 
  | 
  | 
83 | 
  | 
    public
 void refr
esh() {
 | 
|   | 
  | 
  | 
  | 
84 | 
  | 
        Se
rverAuthCo
nfig serve
rAuthConfi
g = this.s
erverAuthC
onfig;
 | 
|   | 
  | 
  | 
  | 
85 | 
  | 
        if
 (serverAu
thConfig !
= null) {
 | 
|   | 
  | 
  | 
  | 
86 | 
  | 
          
  serverAu
thConfig.r
efresh();
 | 
|   | 
  | 
  | 
  | 
87 | 
  | 
        }
 | 
|   | 
  | 
  | 
  | 
88 | 
  | 
    }
 | 
|   | 
  | 
  | 
  | 
89 | 
  | 
}
 |