Compare commits
747
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a2da92cd1 | ||
|
|
02eae5bcba | ||
|
|
3f67c59e21 | ||
|
|
9d8a1edbe9 | ||
|
|
b0ff50652c | ||
|
|
1255118b9e | ||
|
|
4f548b350a | ||
|
|
81472362d3 | ||
|
|
43ad2e1c12 | ||
|
|
df8d4cd35d | ||
|
|
ad88de1f79 | ||
|
|
96311381ef | ||
|
|
d2986abd13 | ||
|
|
ce17999d26 | ||
|
|
d869ab2823 | ||
|
|
5dc6f2f835 | ||
|
|
9b9a656192 | ||
|
|
7e985dce85 | ||
|
|
184108c5ff | ||
|
|
f6ce1438fd | ||
|
|
1b9fe8edf7 | ||
|
|
e205535c55 | ||
|
|
5c25619cd6 | ||
|
|
2e2f34d94e | ||
|
|
7eab4bc859 | ||
|
|
074a312fe5 | ||
|
|
7512abe9a7 | ||
|
|
f48288865b | ||
|
|
333bdb62dd | ||
|
|
07824bdc4d | ||
|
|
905421a292 | ||
|
|
363e948141 | ||
|
|
f7a2ad021e | ||
|
|
e2082ce29f | ||
|
|
462843cc9c | ||
|
|
5890f7cae1 | ||
|
|
767c832f24 | ||
|
|
6e4abe19f3 | ||
|
|
107830bd2c | ||
|
|
90d0ee7934 | ||
|
|
5c731b4d14 | ||
|
|
8402cedd82 | ||
|
|
190a1beefa | ||
|
|
0a7504f9a8 | ||
|
|
da945a69e6 | ||
|
|
c4513fdad9 | ||
|
|
48bd019165 | ||
|
|
5f91f4e466 | ||
|
|
d5167c1632 | ||
|
|
44d7d776bc | ||
|
|
f4ead484de | ||
|
|
6a1fb8f870 | ||
|
|
dd279dd0fd | ||
|
|
111bcb7433 | ||
|
|
8f3cfed7c5 | ||
|
|
807fc71626 | ||
|
|
8ae08f0432 | ||
|
|
2beb1f2466 | ||
|
|
1a9fada964 | ||
|
|
9030edc04d | ||
|
|
3c0f7e2ee2 | ||
|
|
086c29112a | ||
|
|
0df2525298 | ||
|
|
cdb40fce19 | ||
|
|
af5ac7dd6b | ||
|
|
524ad9728a | ||
|
|
b50513a946 | ||
|
|
3203842b58 | ||
|
|
2d036b58a6 | ||
|
|
55910f5f70 | ||
|
|
c1e202eaf9 | ||
|
|
e538394e60 | ||
|
|
46b17e6149 | ||
|
|
e6b3586b87 | ||
|
|
bdaba4c85a | ||
|
|
1510ac5eb4 | ||
|
|
443772d5ec | ||
|
|
72736e5e47 | ||
|
|
ec180db39f | ||
|
|
f6d075fbe4 | ||
|
|
5fc5bafbb6 | ||
|
|
a189545f81 | ||
|
|
1c694b4795 | ||
|
|
819c42dad2 | ||
|
|
7bdccc21b2 | ||
|
|
a9f461bfd1 | ||
|
|
56a565f913 | ||
|
|
b6a76b1267 | ||
|
|
67a63a806e | ||
|
|
816b01860b | ||
|
|
ce2f009e76 | ||
|
|
d5a44db2de | ||
|
|
5474496867 | ||
|
|
54d9943a3b | ||
|
|
81de73df8e | ||
|
|
51312ff7ff | ||
|
|
b2d8c6bca2 | ||
|
|
4c9a0b45d4 | ||
|
|
b3f3449e39 | ||
|
|
a76a4730e3 | ||
|
|
dbeb3353f8 | ||
|
|
a2d1c8313d | ||
|
|
193233899f | ||
|
|
c42b8f81e3 | ||
|
|
13bf36ce49 | ||
|
|
31eee347d4 | ||
|
|
c37f1c24ee | ||
|
|
fba78f3e2a | ||
|
|
ec258c6515 | ||
|
|
087f84bfff | ||
|
|
733a51b1ea | ||
|
|
4141690857 | ||
|
|
0ad86b3a53 | ||
|
|
a39907de76 | ||
|
|
fd2fc34386 | ||
|
|
93d3a0eb38 | ||
|
|
ef95510da4 | ||
|
|
8fab2f0718 | ||
|
|
6da8ca70dc | ||
|
|
2343e517c9 | ||
|
|
60f954a497 | ||
|
|
af30142097 | ||
|
|
c5e287b7b1 | ||
|
|
c206ae13db | ||
|
|
882dbc3f25 | ||
|
|
022be3aee5 | ||
|
|
5f73c338d8 | ||
|
|
f58936025f | ||
|
|
1042a22cf7 | ||
|
|
5148e69006 | ||
|
|
08320890b1 | ||
|
|
5ed09acd94 | ||
|
|
4728729302 | ||
|
|
d016ea4116 | ||
|
|
fa3a2aafec | ||
|
|
d85f9cb4e2 | ||
|
|
9edec8e4a6 | ||
|
|
f12c54387c | ||
|
|
d51a2cde2f | ||
|
|
39d2c3ad81 | ||
|
|
6ee11a94b4 | ||
|
|
b2850ec1d5 | ||
|
|
8d56ab90ba | ||
|
|
3e4f5f40dc | ||
|
|
097c49149c | ||
|
|
a37d43714d | ||
|
|
ff20c530cd | ||
|
|
e0ae98eb95 | ||
|
|
477c0872b0 | ||
|
|
27bdc996e7 | ||
|
|
e52f7c56a9 | ||
|
|
74809b4132 | ||
|
|
bee9ba0c19 | ||
|
|
f4995410f8 | ||
|
|
22a94100c8 | ||
|
|
183feeb952 | ||
|
|
049b0dda23 | ||
|
|
4bc64350b2 | ||
|
|
7f474f574c | ||
|
|
af7fd0ef61 | ||
|
|
7f3ccad4cc | ||
|
|
264c816f08 | ||
|
|
a6f8ff44a6 | ||
|
|
c03c5d2fe9 | ||
|
|
fcfe8582de | ||
|
|
63af03f11c | ||
|
|
fe841e560d | ||
|
|
88583362ad | ||
|
|
babe94c50d | ||
|
|
e7c98bd31b | ||
|
|
771b4c5b6e | ||
|
|
ef716b8b94 | ||
|
|
6bcd72f7f2 | ||
|
|
c434dc8dcc | ||
|
|
92db7b3618 | ||
|
|
62d6bf1dec | ||
|
|
fc9dbcf6cb | ||
|
|
7193b54419 | ||
|
|
686e48e9e2 | ||
|
|
d8ea4bbc00 | ||
|
|
9467370a8f | ||
|
|
fff595b163 | ||
|
|
a46982f8ec | ||
|
|
4ddd2ae31d | ||
|
|
1c1afc9eaa | ||
|
|
e6f0da99e6 | ||
|
|
c59fdb4299 | ||
|
|
0878109647 | ||
|
|
74ff101de4 | ||
|
|
ebc184bf94 | ||
|
|
a09f38589f | ||
|
|
4664bb01d8 | ||
|
|
c9e92bce60 | ||
|
|
c04c047fbd | ||
|
|
9e857fe245 | ||
|
|
9ad584b34d | ||
|
|
43ab806f8d | ||
|
|
18a64103cd | ||
|
|
bb6a7e357f | ||
|
|
0ec23fd40b | ||
|
|
d43b230b93 | ||
|
|
43b51d4a30 | ||
|
|
bea2678e85 | ||
|
|
146a26e714 | ||
|
|
016a19fcee | ||
|
|
9949101fba | ||
|
|
30f4f920c1 | ||
|
|
22200d857c | ||
|
|
713909fac9 | ||
|
|
f4d751c839 | ||
|
|
411b71bcbb | ||
|
|
0ca117b8e9 | ||
|
|
ce450e3806 | ||
|
|
f2c1c26385 | ||
|
|
dbd906b330 | ||
|
|
b7e70ea7e3 | ||
|
|
0c5d1c7090 | ||
|
|
1d87d1cce1 | ||
|
|
39019eed10 | ||
|
|
ddc9766ec9 | ||
|
|
2f4c2c20f9 | ||
|
|
741e10060e | ||
|
|
2a60f65229 | ||
|
|
a5687e4660 | ||
|
|
f337085ed0 | ||
|
|
8418fec113 | ||
|
|
534a7b6e59 | ||
|
|
87a7879e71 | ||
|
|
d35f8c1905 | ||
|
|
53799297b3 | ||
|
|
f5f36545f3 | ||
|
|
40bf5fb5d2 | ||
|
|
49dc5363bb | ||
|
|
1cc4cc30a6 | ||
|
|
8799405673 | ||
|
|
9a3bea7062 | ||
|
|
c392f6659e | ||
|
|
6a75aec6d8 | ||
|
|
a867a1646a | ||
|
|
5abe06a2b7 | ||
|
|
aba69e0628 | ||
|
|
2355db57da | ||
|
|
7796bf3510 | ||
|
|
09d1c8bafc | ||
|
|
dcc9e30e8d | ||
|
|
01a96b62dc | ||
|
|
a206a6d16d | ||
|
|
19c29387fa | ||
|
|
3565706379 | ||
|
|
6ec19d0b63 | ||
|
|
71247538ee | ||
|
|
b491a10aa9 | ||
|
|
20dac1d885 | ||
|
|
1de3d143aa | ||
|
|
0b875d4688 | ||
|
|
acba6cd210 | ||
|
|
231e049771 | ||
|
|
43e88b4d73 | ||
|
|
c52da46e54 | ||
|
|
29d6832882 | ||
|
|
15f4c764bc | ||
|
|
35a9527407 | ||
|
|
cd8ba1653d | ||
|
|
8d9047c338 | ||
|
|
c8d47926b8 | ||
|
|
83370f0666 | ||
|
|
d77c1e616f | ||
|
|
ae56bb30c9 | ||
|
|
27ef919d07 | ||
|
|
dcb6cedfb7 | ||
|
|
95724e36f3 | ||
|
|
ce58f00caa | ||
|
|
225523fee0 | ||
|
|
c7335fa242 | ||
|
|
57ccbb7f49 | ||
|
|
4433a058a4 | ||
|
|
bf76be21c7 | ||
|
|
bbe7ff1dce | ||
|
|
5f16f0ede8 | ||
|
|
7dd2b3d7be | ||
|
|
320a9da585 | ||
|
|
fa8b272e76 | ||
|
|
6c3d31dd4c | ||
|
|
1cc4ca2e71 | ||
|
|
eea19e7850 | ||
|
|
2047363e86 | ||
|
|
0d88c9050a | ||
|
|
236fcd66d4 | ||
|
|
1a5517f986 | ||
|
|
01cc0d0e1d | ||
|
|
e0aedfb93d | ||
|
|
0797cf6db7 | ||
|
|
ec77970021 | ||
|
|
30f34173c5 | ||
|
|
0e52781a1f | ||
|
|
10bda7c96d | ||
|
|
afcdce6b71 | ||
|
|
f6a718f10a | ||
|
|
9335ab6b22 | ||
|
|
631dcd93e6 | ||
|
|
756cc0dca0 | ||
|
|
9fcef2c80f | ||
|
|
19b05ad62f | ||
|
|
578b5e2b59 | ||
|
|
6776f5c341 | ||
|
|
c3c3b90fb9 | ||
|
|
34d5e85316 | ||
|
|
d0a9e45826 | ||
|
|
23b4b4283b | ||
|
|
673253a539 | ||
|
|
4f5b71d81a | ||
|
|
70ae0b2317 | ||
|
|
d91a9df177 | ||
|
|
27fd5f395f | ||
|
|
2f3b5e9b88 | ||
|
|
9edc2000e7 | ||
|
|
b6257e66b3 | ||
|
|
890af8da52 | ||
|
|
974906d37f | ||
|
|
f2f2158154 | ||
|
|
ea99a05ffe | ||
|
|
0cffa5740d | ||
|
|
a341889d2c | ||
|
|
9007f8b19c | ||
|
|
b8832d2d71 | ||
|
|
86dfcecef6 | ||
|
|
8efbdce810 | ||
|
|
1667ada111 | ||
|
|
b6ed681402 | ||
|
|
2dcf96eaad | ||
|
|
b8b40e75ef | ||
|
|
81e4f4b351 | ||
|
|
afc8179cf8 | ||
|
|
919a3791ea | ||
|
|
e490a6e3bd | ||
|
|
eab548d7f0 | ||
|
|
37256b6b8f | ||
|
|
04d76b0052 | ||
|
|
ecd3d2187f | ||
|
|
b3d40c6f85 | ||
|
|
d415bdb3d2 | ||
|
|
060527ac67 | ||
|
|
f71273a1f9 | ||
|
|
656161ff61 | ||
|
|
2044e47d03 | ||
|
|
6baa2228e7 | ||
|
|
d9f82affb0 | ||
|
|
d2e3389414 | ||
|
|
7cf77e1bb4 | ||
|
|
da2ad8f645 | ||
|
|
f4a41071ea | ||
|
|
a44add29b4 | ||
|
|
de8ffae427 | ||
|
|
3d370f9d11 | ||
|
|
257ccbb939 | ||
|
|
bead313e27 | ||
|
|
0ad4041fd9 | ||
|
|
8d1108ba1b | ||
|
|
fb5e5d5cb6 | ||
|
|
899c9f48e9 | ||
|
|
2d36d48356 | ||
|
|
5606160e70 | ||
|
|
cd1094c3ad | ||
|
|
069d362778 | ||
|
|
77c37ccaf6 | ||
|
|
c52c2eb471 | ||
|
|
92d9808cc0 | ||
|
|
8830f87a76 | ||
|
|
600f429abb | ||
|
|
fdcc2d32f6 | ||
|
|
9083bbf669 | ||
|
|
58b5c3d75d | ||
|
|
44c3a56a21 | ||
|
|
6805b991e1 | ||
|
|
e25a0d3cf1 | ||
|
|
ca72a3bd70 | ||
|
|
3f6377b31f | ||
|
|
0008d50dfa | ||
|
|
a723dde180 | ||
|
|
9ef29b6a3e | ||
|
|
2a5fd36b6c | ||
|
|
2d9bb402fc | ||
|
|
44ea920f92 | ||
|
|
b4ce19c231 | ||
|
|
93b54ce13a | ||
|
|
3275b528f9 | ||
|
|
5263101bc0 | ||
|
|
32d7464e52 | ||
|
|
9e3fa4b566 | ||
|
|
f64ffcbefe | ||
|
|
3bc57c19f0 | ||
|
|
5328d760fa | ||
|
|
8095587e63 | ||
|
|
5c4bcdce57 | ||
|
|
125eff9a95 | ||
|
|
641dc9b3ef | ||
|
|
b080e1e782 | ||
|
|
f103480518 | ||
|
|
9af8af73bf | ||
|
|
7279c88638 | ||
|
|
a714896264 | ||
|
|
29eadf915a | ||
|
|
3d310f8cc6 | ||
|
|
5a108c60a0 | ||
|
|
59535e4c43 | ||
|
|
df1c111a72 | ||
|
|
7bcd954e91 | ||
|
|
1754f242c7 | ||
|
|
794c4bc5f1 | ||
|
|
3c3bbdbbdb | ||
|
|
6a428c8ee7 | ||
|
|
d1a3ff8707 | ||
|
|
9f0149d69c | ||
|
|
bb3937e3c1 | ||
|
|
a52fb53ac7 | ||
|
|
d5c0769499 | ||
|
|
8f7f9e0b9c | ||
|
|
6b261cd6e9 | ||
|
|
b2a803929d | ||
|
|
137edf9b1a | ||
|
|
3a669ad7d5 | ||
|
|
7ec82ee7e2 | ||
|
|
515ed226be | ||
|
|
cca91dd175 | ||
|
|
ca46621782 | ||
|
|
1c2eafeb80 | ||
|
|
7109ad247f | ||
|
|
538e49117f | ||
|
|
fcf7b28b8f | ||
|
|
36266b8574 | ||
|
|
8d15520939 | ||
|
|
350a9cd997 | ||
|
|
a67ead6a1b | ||
|
|
512a5ef079 | ||
|
|
d748f7e459 | ||
|
|
bd2238dbb8 | ||
|
|
bed8db7466 | ||
|
|
e4f75409c9 | ||
|
|
98ad9b7e7c | ||
|
|
9579a7317e | ||
|
|
3e9ba71baa | ||
|
|
23e261244c | ||
|
|
65f94fdf84 | ||
|
|
e588860c21 | ||
|
|
dccc338622 | ||
|
|
ba788eb678 | ||
|
|
01beff741d | ||
|
|
5b156595fb | ||
|
|
19deb7c65e | ||
|
|
58b66b788f | ||
|
|
0447d857fd | ||
|
|
42b00ae080 | ||
|
|
eb8d02a691 | ||
|
|
1ba6a27d0e | ||
|
|
ee9c87877f | ||
|
|
38670df49a | ||
|
|
54e745c6c9 | ||
|
|
d730da757e | ||
|
|
fbca45d336 | ||
|
|
ff66d471e2 | ||
|
|
c65a156939 | ||
|
|
def40448ac | ||
|
|
90fc721315 | ||
|
|
ed97a9b6f3 | ||
|
|
8ea057a122 | ||
|
|
5167b623d5 | ||
|
|
1e1bf97ffc | ||
|
|
ef1f34d933 | ||
|
|
57a14627e1 | ||
|
|
1cba5e5428 | ||
|
|
974c5615af | ||
|
|
861e44b9c8 | ||
|
|
c1a8e692d0 | ||
|
|
2a9304eb79 | ||
|
|
e8932bbea0 | ||
|
|
63ad95a766 | ||
|
|
b6d861fea6 | ||
|
|
96424536a7 | ||
|
|
b86f15f32a | ||
|
|
be578684b9 | ||
|
|
bccc5fa7b1 | ||
|
|
d98cd4235c | ||
|
|
08a0862369 | ||
|
|
f2dd556323 | ||
|
|
6dc1194247 | ||
|
|
a7c956bf10 | ||
|
|
0907feb508 | ||
|
|
30e2709bd0 | ||
|
|
f585f5dfc9 | ||
|
|
61ae15cf56 | ||
|
|
139e19514b | ||
|
|
19b82f00d4 | ||
|
|
623ec6c510 | ||
|
|
a1b6310777 | ||
|
|
d395a9e318 | ||
|
|
729d73bb17 | ||
|
|
2694e003c4 | ||
|
|
5854e44391 | ||
|
|
361f0b5048 | ||
|
|
8de8446cb5 | ||
|
|
6ccf3549ad | ||
|
|
c469109d22 | ||
|
|
8164c05cb8 | ||
|
|
b8c08d05bf | ||
|
|
0419bb2232 | ||
|
|
72371e5d76 | ||
|
|
f0b168c18f | ||
|
|
3d5055d920 | ||
|
|
0fc4ca0d12 | ||
|
|
4db73942e6 | ||
|
|
0c829cd605 | ||
|
|
e876a3c988 | ||
|
|
91cbfbd37f | ||
|
|
4a285bae9b | ||
|
|
804dd13abd | ||
|
|
0d6c72a378 | ||
|
|
17b84df631 | ||
|
|
784b724fe0 | ||
|
|
65dc7ddb44 | ||
|
|
120b880427 | ||
|
|
a4335c3eb8 | ||
|
|
373ded9761 | ||
|
|
3e9ae7aa82 | ||
|
|
21a2a47172 | ||
|
|
92c1e01d0e | ||
|
|
3dbf5ee389 | ||
|
|
55c5e9a381 | ||
|
|
1f26765546 | ||
|
|
c4a11cd52a | ||
|
|
b924cf9e9f | ||
|
|
1714422b10 | ||
|
|
7cea4f6695 | ||
|
|
85622ac522 | ||
|
|
48551d362a | ||
|
|
cee8fee504 | ||
|
|
9a4308e092 | ||
|
|
93b3f448d3 | ||
|
|
8beff63dc0 | ||
|
|
6b5f26ab23 | ||
|
|
4ed1061487 | ||
|
|
3a8b450575 | ||
|
|
e6df30602e | ||
|
|
72299b4844 | ||
|
|
4e4559fdc2 | ||
|
|
dcdef4daa4 | ||
|
|
9299591272 | ||
|
|
571a4389e9 | ||
|
|
78b11bca84 | ||
|
|
ff73e1a36a | ||
|
|
134c9b11c0 | ||
|
|
dfa7c76331 | ||
|
|
f21cede378 | ||
|
|
80dfc63768 | ||
|
|
29ffe96388 | ||
|
|
4d5ae5dd68 | ||
|
|
6a3b5cd4c0 | ||
|
|
afd3a36ee4 | ||
|
|
e02d0ed629 | ||
|
|
a4d9aaf916 | ||
|
|
f83b67cdf5 | ||
|
|
46f6b97c26 | ||
|
|
5d7b549323 | ||
|
|
7f88e769f2 | ||
|
|
36bc97e3cd | ||
|
|
3b55bd08a6 | ||
|
|
d35ccd9a5e | ||
|
|
0fea54ebb5 | ||
|
|
7c9dbdfc91 | ||
|
|
4ce8b2431b | ||
|
|
e506e385f1 | ||
|
|
c52500ce88 | ||
|
|
6ab411b2de | ||
|
|
e7f7a5f6c8 | ||
|
|
d1552cd6e8 | ||
|
|
545fb8b849 | ||
|
|
f71a6ec904 | ||
|
|
e4fcaad243 | ||
|
|
9cf788c590 | ||
|
|
3d3d526e30 | ||
|
|
020d090aee | ||
|
|
1d2fef5b9b | ||
|
|
2cc3588be5 | ||
|
|
12bf4b498e | ||
|
|
6b6a673642 | ||
|
|
ad7a6c4854 | ||
|
|
47773371e3 | ||
|
|
d0aeb25f14 | ||
|
|
89158c9dcf | ||
|
|
dfc4cf36a2 | ||
|
|
0f52768064 | ||
|
|
2641a93943 | ||
|
|
1dd4bdf0b7 | ||
|
|
73d74f69c3 | ||
|
|
28c70fa8ab | ||
|
|
17fcc38157 | ||
|
|
add41ea92b | ||
|
|
e497eb0950 | ||
|
|
cb4f95416c | ||
|
|
b253fe9532 | ||
|
|
e2436c4722 | ||
|
|
76a4db5d54 | ||
|
|
790a068bdb | ||
|
|
95d222348d | ||
|
|
7bdf9f4ba1 | ||
|
|
c9545e16f7 | ||
|
|
f6dea6752c | ||
|
|
0f5caffbab | ||
|
|
16061ec727 | ||
|
|
6030a65d1b | ||
|
|
29c7cb9061 | ||
|
|
a9c7bbd44c | ||
|
|
c973dc9eee | ||
|
|
16ec76e864 | ||
|
|
20fe2b75b5 | ||
|
|
d7fbfc05e8 | ||
|
|
8f1292494f | ||
|
|
0ef36096fb | ||
|
|
5181e95776 | ||
|
|
cc02b16742 | ||
|
|
50f8846c3d | ||
|
|
22ce20ff6b | ||
|
|
0dea5eac46 | ||
|
|
f9595fc6c5 | ||
|
|
4c6dd10e48 | ||
|
|
25363a91f9 | ||
|
|
756cea5fb2 | ||
|
|
7ffd6dc7a7 | ||
|
|
4a06d7590e | ||
|
|
18b07190bf | ||
|
|
1cfe58bccd | ||
|
|
705a598ce6 | ||
|
|
23091ec738 | ||
|
|
2c9172f707 | ||
|
|
741fa16ec7 | ||
|
|
5c912d3501 | ||
|
|
e2e96f7183 | ||
|
|
4193856fbb | ||
|
|
e56759a6c0 | ||
|
|
ce717fa20e | ||
|
|
204d226267 | ||
|
|
ca67e8a764 | ||
|
|
60667e65e7 | ||
|
|
3b7101650e | ||
|
|
82300a90f8 | ||
|
|
49c5610971 | ||
|
|
75ef3efd15 | ||
|
|
e7ec454f81 | ||
|
|
a80a65c525 | ||
|
|
973619d7c0 | ||
|
|
50ed089980 | ||
|
|
3e208c10aa | ||
|
|
fa8af64098 | ||
|
|
c61b457c02 | ||
|
|
5c98b8c6ae | ||
|
|
3e6b6507f4 | ||
|
|
d285721063 | ||
|
|
95a1fc32eb | ||
|
|
13d2f872ff | ||
|
|
7a05078030 | ||
|
|
5c3159c83d | ||
|
|
f63655edf3 | ||
|
|
23aa490c72 | ||
|
|
1691ae7e29 | ||
|
|
804fb2dc96 | ||
|
|
975dcb68a9 | ||
|
|
e24ce91e81 | ||
|
|
2d188068c4 | ||
|
|
214cd2ac22 | ||
|
|
1142ed5583 | ||
|
|
85ccd64e01 | ||
|
|
73c3534e7a | ||
|
|
c6a7d0b772 | ||
|
|
4f0d827aca | ||
|
|
7342261dbe | ||
|
|
8f2c5af7d1 | ||
|
|
018b104cbf | ||
|
|
b3bb68aed7 | ||
|
|
bdfc9b8efc | ||
|
|
3b1987cb3a | ||
|
|
18c0e8946a | ||
|
|
25f965aa2e | ||
|
|
50e5d203b3 | ||
|
|
41358eea4d | ||
|
|
4b69cb4551 | ||
|
|
b0264d528d | ||
|
|
82ad26189f | ||
|
|
cd299c995b | ||
|
|
2ab8f320c3 | ||
|
|
36f2febde1 | ||
|
|
dbc49dd742 | ||
|
|
55e9f2e21b | ||
|
|
dd3e6b29bf | ||
|
|
81f1baff33 | ||
|
|
e3f24f58df | ||
|
|
1939f25a71 | ||
|
|
76df229967 | ||
|
|
3ce6deaa1b | ||
|
|
428b85f1f8 | ||
|
|
89a1141f8d | ||
|
|
12e5dfa3e5 | ||
|
|
4ff4f69343 | ||
|
|
06545f2543 | ||
|
|
9e836162b7 | ||
|
|
42f4e7fef8 | ||
|
|
0708bceea7 | ||
|
|
f72b0f3f6d | ||
|
|
a27fd7ae1f | ||
|
|
768a3ab941 | ||
|
|
5790dd44a4 | ||
|
|
3b44ebb6d9 | ||
|
|
d2b5cf08c6 | ||
|
|
f8ec178fae | ||
|
|
062c8a06ab | ||
|
|
6a48e00039 | ||
|
|
6d0e5d6ad1 | ||
|
|
001ae5146a | ||
|
|
23175bf925 | ||
|
|
cf10a09008 | ||
|
|
8a4a1660a4 | ||
|
|
4e0e4df630 | ||
|
|
0519f0fed5 | ||
|
|
36f64b2e23 | ||
|
|
94a2c3ab0e | ||
|
|
28fe13a800 | ||
|
|
b9fea7b143 | ||
|
|
ae63830c22 | ||
|
|
96967c0373 | ||
|
|
6e0eb21428 | ||
|
|
e295efed07 | ||
|
|
cd2f6e83b3 | ||
|
|
d722e53108 | ||
|
|
28252e2409 | ||
|
|
746d285c7b | ||
|
|
32b29bb130 | ||
|
|
583f8ad739 | ||
|
|
321b23a78d | ||
|
|
bcace1eacf | ||
|
|
dad4945358 | ||
|
|
f914a30b6e | ||
|
|
d65fb963e6 | ||
|
|
5772ea2b09 | ||
|
|
620f22249a | ||
|
|
29052019c5 | ||
|
|
2d7424c697 | ||
|
|
ddc0792733 | ||
|
|
cd063c6a36 | ||
|
|
a35aa47f27 |
No files matched your search
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@@ -65,6 +65,11 @@
|
|||||||
<artifactId>keycloak-core</artifactId>
|
<artifactId>keycloak-core</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<artifactId>keycloak-authz-client</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-core</artifactId>
|
<artifactId>jackson-core</artifactId>
|
||||||
|
|||||||
+11
-5
@@ -169,11 +169,7 @@ public class AdapterDeploymentContext {
|
|||||||
public void setAuthServerBaseUrl(String authServerBaseUrl) {
|
public void setAuthServerBaseUrl(String authServerBaseUrl) {
|
||||||
this.authServerBaseUrl = authServerBaseUrl;
|
this.authServerBaseUrl = authServerBaseUrl;
|
||||||
KeycloakUriBuilder serverBuilder = KeycloakUriBuilder.fromUri(authServerBaseUrl);
|
KeycloakUriBuilder serverBuilder = KeycloakUriBuilder.fromUri(authServerBaseUrl);
|
||||||
resolveBrowserUrls(serverBuilder);
|
resolveUrls(serverBuilder);
|
||||||
|
|
||||||
if (delegate.getRelativeUrls() == RelativeUrlsUsed.ALL_REQUESTS) {
|
|
||||||
resolveNonBrowserUrls(serverBuilder);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -460,6 +456,16 @@ public class AdapterDeploymentContext {
|
|||||||
public void setTurnOffChangeSessionIdOnLogin(boolean turnOffChangeSessionIdOnLogin) {
|
public void setTurnOffChangeSessionIdOnLogin(boolean turnOffChangeSessionIdOnLogin) {
|
||||||
delegate.setTurnOffChangeSessionIdOnLogin(turnOffChangeSessionIdOnLogin);
|
delegate.setTurnOffChangeSessionIdOnLogin(turnOffChangeSessionIdOnLogin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getTokenMinimumTimeToLive() {
|
||||||
|
return delegate.getTokenMinimumTimeToLive();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTokenMinimumTimeToLive(final int tokenMinimumTimeToLive) {
|
||||||
|
delegate.setTokenMinimumTimeToLive(tokenMinimumTimeToLive);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected KeycloakUriBuilder getBaseBuilder(HttpFacade facade, String base) {
|
protected KeycloakUriBuilder getBaseBuilder(HttpFacade facade, String base) {
|
||||||
|
|||||||
@@ -38,37 +38,6 @@ public class AdapterUtils {
|
|||||||
return UUID.randomUUID().toString();
|
return UUID.randomUUID().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Best effort to find origin for REST request calls from web UI application to REST application. In case of relative or absolute
|
|
||||||
* "auth-server-url" is returned the URL from request. In case of "auth-server-url-for-backend-request" used in configuration, it returns
|
|
||||||
* the origin of auth server.
|
|
||||||
*
|
|
||||||
* This may be the optimization in cluster, so if you have keycloak and applications on same host, the REST request doesn't need to
|
|
||||||
* go through loadbalancer, but can be sent directly to same host.
|
|
||||||
*
|
|
||||||
* @param browserRequestURL
|
|
||||||
* @param session
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String getOriginForRestCalls(String browserRequestURL, KeycloakSecurityContext session) {
|
|
||||||
if (session instanceof RefreshableKeycloakSecurityContext) {
|
|
||||||
KeycloakDeployment deployment = ((RefreshableKeycloakSecurityContext)session).getDeployment();
|
|
||||||
switch (deployment.getRelativeUrls()) {
|
|
||||||
case ALL_REQUESTS:
|
|
||||||
case NEVER:
|
|
||||||
// Resolve baseURI from the request
|
|
||||||
return UriUtils.getOrigin(browserRequestURL);
|
|
||||||
case BROWSER_ONLY:
|
|
||||||
// Resolve baseURI from the codeURL (This is already non-relative and based on our hostname)
|
|
||||||
return UriUtils.getOrigin(deployment.getTokenUrl());
|
|
||||||
default:
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return UriUtils.getOrigin(browserRequestURL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Set<String> getRolesFromSecurityContext(RefreshableKeycloakSecurityContext session) {
|
public static Set<String> getRolesFromSecurityContext(RefreshableKeycloakSecurityContext session) {
|
||||||
Set<String> roles = null;
|
Set<String> roles = null;
|
||||||
AccessToken accessToken = session.getToken();
|
AccessToken accessToken = session.getToken();
|
||||||
|
|||||||
+26
-1
@@ -18,10 +18,12 @@
|
|||||||
package org.keycloak.adapters;
|
package org.keycloak.adapters;
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
import org.keycloak.AuthorizationContext;
|
||||||
import org.keycloak.KeycloakSecurityContext;
|
import org.keycloak.KeycloakSecurityContext;
|
||||||
|
import org.keycloak.adapters.authorization.PolicyEnforcer;
|
||||||
|
import org.keycloak.common.util.UriUtils;
|
||||||
import org.keycloak.constants.AdapterConstants;
|
import org.keycloak.constants.AdapterConstants;
|
||||||
import org.keycloak.representations.AccessToken;
|
import org.keycloak.representations.AccessToken;
|
||||||
import org.keycloak.common.util.UriUtils;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -55,6 +57,9 @@ public class AuthenticatedActionsHandler {
|
|||||||
queryBearerToken();
|
queryBearerToken();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (!isAuthorized()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,4 +129,24 @@ public class AuthenticatedActionsHandler {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isAuthorized() {
|
||||||
|
PolicyEnforcer policyEnforcer = this.deployment.getPolicyEnforcer();
|
||||||
|
|
||||||
|
if (policyEnforcer == null) {
|
||||||
|
log.debugv("Policy enforcement is disabled.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
OIDCHttpFacade facade = (OIDCHttpFacade) this.facade;
|
||||||
|
AuthorizationContext authorizationContext = policyEnforcer.enforce(facade);
|
||||||
|
RefreshableKeycloakSecurityContext session = (RefreshableKeycloakSecurityContext) facade.getSecurityContext();
|
||||||
|
|
||||||
|
session.setAuthorizationContext(authorizationContext);
|
||||||
|
|
||||||
|
return authorizationContext.isGranted();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("Failed to enforce policy decisions.", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+2
@@ -24,6 +24,7 @@ import org.apache.http.client.HttpClient;
|
|||||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||||
import org.apache.http.client.methods.HttpPost;
|
import org.apache.http.client.methods.HttpPost;
|
||||||
import org.apache.http.message.BasicNameValuePair;
|
import org.apache.http.message.BasicNameValuePair;
|
||||||
|
import org.apache.http.util.EntityUtils;
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
import org.keycloak.OAuth2Constants;
|
import org.keycloak.OAuth2Constants;
|
||||||
import org.keycloak.adapters.authentication.ClientCredentialsProviderUtils;
|
import org.keycloak.adapters.authentication.ClientCredentialsProviderUtils;
|
||||||
@@ -104,6 +105,7 @@ public class BasicAuthRequestAuthenticator extends BearerTokenRequestAuthenticat
|
|||||||
int status = response.getStatusLine().getStatusCode();
|
int status = response.getStatusLine().getStatusCode();
|
||||||
HttpEntity entity = response.getEntity();
|
HttpEntity entity = response.getEntity();
|
||||||
if (status != 200) {
|
if (status != 200) {
|
||||||
|
EntityUtils.consumeQuietly(entity);
|
||||||
throw new java.io.IOException("Bad status: " + status);
|
throw new java.io.IOException("Bad status: " + status);
|
||||||
}
|
}
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
|
|||||||
+38
-10
@@ -17,9 +17,11 @@
|
|||||||
|
|
||||||
package org.keycloak.adapters;
|
package org.keycloak.adapters;
|
||||||
|
|
||||||
|
import org.apache.http.HttpHost;
|
||||||
import org.apache.http.client.CookieStore;
|
import org.apache.http.client.CookieStore;
|
||||||
import org.apache.http.client.HttpClient;
|
import org.apache.http.client.HttpClient;
|
||||||
import org.apache.http.conn.ClientConnectionManager;
|
import org.apache.http.conn.ClientConnectionManager;
|
||||||
|
import org.apache.http.conn.params.ConnRoutePNames;
|
||||||
import org.apache.http.conn.scheme.PlainSocketFactory;
|
import org.apache.http.conn.scheme.PlainSocketFactory;
|
||||||
import org.apache.http.conn.scheme.Scheme;
|
import org.apache.http.conn.scheme.Scheme;
|
||||||
import org.apache.http.conn.scheme.SchemeRegistry;
|
import org.apache.http.conn.scheme.SchemeRegistry;
|
||||||
@@ -34,9 +36,9 @@ import org.apache.http.impl.conn.SingleClientConnManager;
|
|||||||
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
|
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
|
||||||
import org.apache.http.params.BasicHttpParams;
|
import org.apache.http.params.BasicHttpParams;
|
||||||
import org.apache.http.params.HttpConnectionParams;
|
import org.apache.http.params.HttpConnectionParams;
|
||||||
import org.keycloak.representations.adapters.config.AdapterConfig;
|
|
||||||
import org.keycloak.common.util.EnvUtil;
|
import org.keycloak.common.util.EnvUtil;
|
||||||
import org.keycloak.common.util.KeystoreUtil;
|
import org.keycloak.common.util.KeystoreUtil;
|
||||||
|
import org.keycloak.representations.adapters.config.AdapterConfig;
|
||||||
|
|
||||||
import javax.net.ssl.HostnameVerifier;
|
import javax.net.ssl.HostnameVerifier;
|
||||||
import javax.net.ssl.SSLContext;
|
import javax.net.ssl.SSLContext;
|
||||||
@@ -46,6 +48,7 @@ import javax.net.ssl.SSLSocket;
|
|||||||
import javax.net.ssl.TrustManager;
|
import javax.net.ssl.TrustManager;
|
||||||
import javax.net.ssl.X509TrustManager;
|
import javax.net.ssl.X509TrustManager;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.URI;
|
||||||
import java.security.KeyStore;
|
import java.security.KeyStore;
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
import java.security.cert.CertificateException;
|
import java.security.cert.CertificateException;
|
||||||
@@ -112,6 +115,7 @@ public class HttpClientBuilder {
|
|||||||
protected TimeUnit socketTimeoutUnits = TimeUnit.MILLISECONDS;
|
protected TimeUnit socketTimeoutUnits = TimeUnit.MILLISECONDS;
|
||||||
protected long establishConnectionTimeout = -1;
|
protected long establishConnectionTimeout = -1;
|
||||||
protected TimeUnit establishConnectionTimeoutUnits = TimeUnit.MILLISECONDS;
|
protected TimeUnit establishConnectionTimeoutUnits = TimeUnit.MILLISECONDS;
|
||||||
|
protected HttpHost proxyHost;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -121,8 +125,7 @@ public class HttpClientBuilder {
|
|||||||
* @param unit
|
* @param unit
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public HttpClientBuilder socketTimeout(long timeout, TimeUnit unit)
|
public HttpClientBuilder socketTimeout(long timeout, TimeUnit unit) {
|
||||||
{
|
|
||||||
this.socketTimeout = timeout;
|
this.socketTimeout = timeout;
|
||||||
this.socketTimeoutUnits = unit;
|
this.socketTimeoutUnits = unit;
|
||||||
return this;
|
return this;
|
||||||
@@ -135,8 +138,7 @@ public class HttpClientBuilder {
|
|||||||
* @param unit
|
* @param unit
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public HttpClientBuilder establishConnectionTimeout(long timeout, TimeUnit unit)
|
public HttpClientBuilder establishConnectionTimeout(long timeout, TimeUnit unit) {
|
||||||
{
|
|
||||||
this.establishConnectionTimeout = timeout;
|
this.establishConnectionTimeout = timeout;
|
||||||
this.establishConnectionTimeoutUnits = unit;
|
this.establishConnectionTimeoutUnits = unit;
|
||||||
return this;
|
return this;
|
||||||
@@ -287,16 +289,20 @@ public class HttpClientBuilder {
|
|||||||
cm = new SingleClientConnManager(registry);
|
cm = new SingleClientConnManager(registry);
|
||||||
}
|
}
|
||||||
BasicHttpParams params = new BasicHttpParams();
|
BasicHttpParams params = new BasicHttpParams();
|
||||||
if (socketTimeout > -1)
|
|
||||||
{
|
if (proxyHost != null) {
|
||||||
|
params.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxyHost);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (socketTimeout > -1) {
|
||||||
HttpConnectionParams.setSoTimeout(params, (int) socketTimeoutUnits.toMillis(socketTimeout));
|
HttpConnectionParams.setSoTimeout(params, (int) socketTimeoutUnits.toMillis(socketTimeout));
|
||||||
|
|
||||||
}
|
}
|
||||||
if (establishConnectionTimeout > -1)
|
if (establishConnectionTimeout > -1) {
|
||||||
{
|
HttpConnectionParams.setConnectionTimeout(params, (int) establishConnectionTimeoutUnits.toMillis(establishConnectionTimeout));
|
||||||
HttpConnectionParams.setConnectionTimeout(params, (int)establishConnectionTimeoutUnits.toMillis(establishConnectionTimeout));
|
|
||||||
}
|
}
|
||||||
DefaultHttpClient client = new DefaultHttpClient(cm, params);
|
DefaultHttpClient client = new DefaultHttpClient(cm, params);
|
||||||
|
|
||||||
if (disableCookieCache) {
|
if (disableCookieCache) {
|
||||||
client.setCookieStore(new CookieStore() {
|
client.setCookieStore(new CookieStore() {
|
||||||
@Override
|
@Override
|
||||||
@@ -364,6 +370,28 @@ public class HttpClientBuilder {
|
|||||||
} else {
|
} else {
|
||||||
trustStore(truststore);
|
trustStore(truststore);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configureProxyForAuthServerIfProvided(adapterConfig);
|
||||||
|
|
||||||
return build();
|
return build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures a the proxy to use for auth-server requests if provided.
|
||||||
|
* <p>
|
||||||
|
* If the given {@link AdapterConfig} contains the attribute {@code proxy-url} we use the
|
||||||
|
* given URL as a proxy server, otherwise the proxy configuration is ignored.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param adapterConfig
|
||||||
|
*/
|
||||||
|
private void configureProxyForAuthServerIfProvided(AdapterConfig adapterConfig) {
|
||||||
|
|
||||||
|
if (adapterConfig == null || adapterConfig.getProxyUrl() == null || adapterConfig.getProxyUrl().trim().isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
URI uri = URI.create(adapterConfig.getProxyUrl());
|
||||||
|
this.proxyHost = new HttpHost(uri.getHost(), uri.getPort(), uri.getScheme());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+26
-38
@@ -20,6 +20,7 @@ package org.keycloak.adapters;
|
|||||||
import org.apache.http.client.HttpClient;
|
import org.apache.http.client.HttpClient;
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
import org.keycloak.adapters.authentication.ClientCredentialsProvider;
|
import org.keycloak.adapters.authentication.ClientCredentialsProvider;
|
||||||
|
import org.keycloak.adapters.authorization.PolicyEnforcer;
|
||||||
import org.keycloak.constants.ServiceUrlConstants;
|
import org.keycloak.constants.ServiceUrlConstants;
|
||||||
import org.keycloak.common.enums.RelativeUrlsUsed;
|
import org.keycloak.common.enums.RelativeUrlsUsed;
|
||||||
import org.keycloak.common.enums.SslRequired;
|
import org.keycloak.common.enums.SslRequired;
|
||||||
@@ -77,6 +78,8 @@ public class KeycloakDeployment {
|
|||||||
protected boolean turnOffChangeSessionIdOnLogin;
|
protected boolean turnOffChangeSessionIdOnLogin;
|
||||||
|
|
||||||
protected volatile int notBefore;
|
protected volatile int notBefore;
|
||||||
|
protected int tokenMinimumTimeToLive;
|
||||||
|
private PolicyEnforcer policyEnforcer;
|
||||||
|
|
||||||
public KeycloakDeployment() {
|
public KeycloakDeployment() {
|
||||||
}
|
}
|
||||||
@@ -111,39 +114,17 @@ public class KeycloakDeployment {
|
|||||||
|
|
||||||
public void setAuthServerBaseUrl(AdapterConfig config) {
|
public void setAuthServerBaseUrl(AdapterConfig config) {
|
||||||
this.authServerBaseUrl = config.getAuthServerUrl();
|
this.authServerBaseUrl = config.getAuthServerUrl();
|
||||||
String authServerURLForBackendReqs = config.getAuthServerUrlForBackendRequests();
|
if (authServerBaseUrl == null) return;
|
||||||
if (authServerBaseUrl == null && authServerURLForBackendReqs == null) return;
|
|
||||||
|
|
||||||
URI authServerUri = null;
|
URI authServerUri = URI.create(authServerBaseUrl);
|
||||||
if (authServerBaseUrl != null) {
|
|
||||||
authServerUri = URI.create(authServerBaseUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (authServerUri == null || authServerUri.getHost() == null) {
|
if (authServerUri.getHost() == null) {
|
||||||
if (authServerURLForBackendReqs != null) {
|
relativeUrls = RelativeUrlsUsed.ALWAYS;
|
||||||
relativeUrls = RelativeUrlsUsed.BROWSER_ONLY;
|
|
||||||
|
|
||||||
KeycloakUriBuilder serverBuilder = KeycloakUriBuilder.fromUri(authServerURLForBackendReqs);
|
|
||||||
if (serverBuilder.getHost() == null || serverBuilder.getScheme() == null) {
|
|
||||||
throw new IllegalStateException("Relative URL not supported for auth-server-url-for-backend-requests option. URL used: "
|
|
||||||
+ authServerURLForBackendReqs + ", Client: " + config.getResource());
|
|
||||||
}
|
|
||||||
resolveNonBrowserUrls(serverBuilder);
|
|
||||||
} else {
|
|
||||||
relativeUrls = RelativeUrlsUsed.ALL_REQUESTS;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// We have absolute URI in config
|
// We have absolute URI in config
|
||||||
relativeUrls = RelativeUrlsUsed.NEVER;
|
relativeUrls = RelativeUrlsUsed.NEVER;
|
||||||
KeycloakUriBuilder serverBuilder = KeycloakUriBuilder.fromUri(authServerBaseUrl);
|
KeycloakUriBuilder serverBuilder = KeycloakUriBuilder.fromUri(authServerBaseUrl);
|
||||||
resolveBrowserUrls(serverBuilder);
|
resolveUrls(serverBuilder);
|
||||||
|
|
||||||
if (authServerURLForBackendReqs == null) {
|
|
||||||
resolveNonBrowserUrls(serverBuilder);
|
|
||||||
} else {
|
|
||||||
serverBuilder = KeycloakUriBuilder.fromUri(authServerURLForBackendReqs);
|
|
||||||
resolveNonBrowserUrls(serverBuilder);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,23 +133,14 @@ public class KeycloakDeployment {
|
|||||||
/**
|
/**
|
||||||
* @param authUrlBuilder absolute URI
|
* @param authUrlBuilder absolute URI
|
||||||
*/
|
*/
|
||||||
protected void resolveBrowserUrls(KeycloakUriBuilder authUrlBuilder) {
|
protected void resolveUrls(KeycloakUriBuilder authUrlBuilder) {
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
log.debug("resolveBrowserUrls");
|
log.debug("resolveUrls");
|
||||||
}
|
}
|
||||||
|
|
||||||
String login = authUrlBuilder.clone().path(ServiceUrlConstants.AUTH_PATH).build(getRealm()).toString();
|
String login = authUrlBuilder.clone().path(ServiceUrlConstants.AUTH_PATH).build(getRealm()).toString();
|
||||||
authUrl = KeycloakUriBuilder.fromUri(login);
|
authUrl = KeycloakUriBuilder.fromUri(login);
|
||||||
realmInfoUrl = authUrlBuilder.clone().path(ServiceUrlConstants.REALM_INFO_PATH).build(getRealm()).toString();
|
realmInfoUrl = authUrlBuilder.clone().path(ServiceUrlConstants.REALM_INFO_PATH).build(getRealm()).toString();
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param authUrlBuilder absolute URI
|
|
||||||
*/
|
|
||||||
protected void resolveNonBrowserUrls(KeycloakUriBuilder authUrlBuilder) {
|
|
||||||
if (log.isDebugEnabled()) {
|
|
||||||
log.debug("resolveNonBrowserUrls");
|
|
||||||
}
|
|
||||||
|
|
||||||
tokenUrl = authUrlBuilder.clone().path(ServiceUrlConstants.TOKEN_PATH).build(getRealm()).toString();
|
tokenUrl = authUrlBuilder.clone().path(ServiceUrlConstants.TOKEN_PATH).build(getRealm()).toString();
|
||||||
logoutUrl = KeycloakUriBuilder.fromUri(authUrlBuilder.clone().path(ServiceUrlConstants.TOKEN_SERVICE_LOGOUT_PATH).build(getRealm()).toString());
|
logoutUrl = KeycloakUriBuilder.fromUri(authUrlBuilder.clone().path(ServiceUrlConstants.TOKEN_SERVICE_LOGOUT_PATH).build(getRealm()).toString());
|
||||||
@@ -388,4 +360,20 @@ public class KeycloakDeployment {
|
|||||||
public void setTurnOffChangeSessionIdOnLogin(boolean turnOffChangeSessionIdOnLogin) {
|
public void setTurnOffChangeSessionIdOnLogin(boolean turnOffChangeSessionIdOnLogin) {
|
||||||
this.turnOffChangeSessionIdOnLogin = turnOffChangeSessionIdOnLogin;
|
this.turnOffChangeSessionIdOnLogin = turnOffChangeSessionIdOnLogin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getTokenMinimumTimeToLive() {
|
||||||
|
return tokenMinimumTimeToLive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTokenMinimumTimeToLive(final int tokenMinimumTimeToLive) {
|
||||||
|
this.tokenMinimumTimeToLive = tokenMinimumTimeToLive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPolicyEnforcer(PolicyEnforcer policyEnforcer) {
|
||||||
|
this.policyEnforcer = policyEnforcer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PolicyEnforcer getPolicyEnforcer() {
|
||||||
|
return policyEnforcer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+10
-1
@@ -21,10 +21,12 @@ import com.fasterxml.jackson.annotation.JsonInclude;
|
|||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
import org.keycloak.adapters.authentication.ClientCredentialsProviderUtils;
|
import org.keycloak.adapters.authentication.ClientCredentialsProviderUtils;
|
||||||
|
import org.keycloak.adapters.authorization.PolicyEnforcer;
|
||||||
import org.keycloak.common.enums.SslRequired;
|
import org.keycloak.common.enums.SslRequired;
|
||||||
|
import org.keycloak.common.util.PemUtils;
|
||||||
import org.keycloak.enums.TokenStore;
|
import org.keycloak.enums.TokenStore;
|
||||||
import org.keycloak.representations.adapters.config.AdapterConfig;
|
import org.keycloak.representations.adapters.config.AdapterConfig;
|
||||||
import org.keycloak.common.util.PemUtils;
|
import org.keycloak.representations.adapters.config.PolicyEnforcerConfig;
|
||||||
import org.keycloak.util.SystemPropertiesJsonParserFactory;
|
import org.keycloak.util.SystemPropertiesJsonParserFactory;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -94,6 +96,7 @@ public class KeycloakDeploymentBuilder {
|
|||||||
deployment.setAlwaysRefreshToken(adapterConfig.isAlwaysRefreshToken());
|
deployment.setAlwaysRefreshToken(adapterConfig.isAlwaysRefreshToken());
|
||||||
deployment.setRegisterNodeAtStartup(adapterConfig.isRegisterNodeAtStartup());
|
deployment.setRegisterNodeAtStartup(adapterConfig.isRegisterNodeAtStartup());
|
||||||
deployment.setRegisterNodePeriod(adapterConfig.getRegisterNodePeriod());
|
deployment.setRegisterNodePeriod(adapterConfig.getRegisterNodePeriod());
|
||||||
|
deployment.setTokenMinimumTimeToLive(adapterConfig.getTokenMinimumTimeToLive());
|
||||||
|
|
||||||
if (realmKeyPem == null && adapterConfig.isBearerOnly() && adapterConfig.getAuthServerUrl() == null) {
|
if (realmKeyPem == null && adapterConfig.isBearerOnly() && adapterConfig.getAuthServerUrl() == null) {
|
||||||
throw new IllegalArgumentException("For bearer auth, you must set the realm-public-key or auth-server-url");
|
throw new IllegalArgumentException("For bearer auth, you must set the realm-public-key or auth-server-url");
|
||||||
@@ -109,6 +112,12 @@ public class KeycloakDeploymentBuilder {
|
|||||||
deployment.setTurnOffChangeSessionIdOnLogin(adapterConfig.getTurnOffChangeSessionIdOnLogin());
|
deployment.setTurnOffChangeSessionIdOnLogin(adapterConfig.getTurnOffChangeSessionIdOnLogin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PolicyEnforcerConfig policyEnforcerConfig = adapterConfig.getPolicyEnforcerConfig();
|
||||||
|
|
||||||
|
if (policyEnforcerConfig != null) {
|
||||||
|
deployment.setPolicyEnforcer(new PolicyEnforcer(deployment, adapterConfig));
|
||||||
|
}
|
||||||
|
|
||||||
log.debug("Use authServerUrl: " + deployment.getAuthServerBaseUrl() + ", tokenUrl: " + deployment.getTokenUrl() + ", relativeUrls: " + deployment.getRelativeUrls());
|
log.debug("Use authServerUrl: " + deployment.getAuthServerBaseUrl() + ", tokenUrl: " + deployment.getTokenUrl() + ", relativeUrls: " + deployment.getRelativeUrls());
|
||||||
return deployment;
|
return deployment;
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-2
@@ -18,9 +18,11 @@
|
|||||||
package org.keycloak.adapters;
|
package org.keycloak.adapters;
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
import org.keycloak.AuthorizationContext;
|
||||||
import org.keycloak.KeycloakSecurityContext;
|
import org.keycloak.KeycloakSecurityContext;
|
||||||
import org.keycloak.RSATokenVerifier;
|
import org.keycloak.RSATokenVerifier;
|
||||||
import org.keycloak.common.VerificationException;
|
import org.keycloak.common.VerificationException;
|
||||||
|
import org.keycloak.common.util.Time;
|
||||||
import org.keycloak.representations.AccessToken;
|
import org.keycloak.representations.AccessToken;
|
||||||
import org.keycloak.representations.AccessTokenResponse;
|
import org.keycloak.representations.AccessTokenResponse;
|
||||||
import org.keycloak.representations.IDToken;
|
import org.keycloak.representations.IDToken;
|
||||||
@@ -74,7 +76,11 @@ public class RefreshableKeycloakSecurityContext extends KeycloakSecurityContext
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isActive() {
|
public boolean isActive() {
|
||||||
return token != null && this.token.isActive() && this.token.getIssuedAt() > deployment.getNotBefore();
|
return token != null && this.token.isActive() && deployment!=null && this.token.getIssuedAt() > deployment.getNotBefore();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTokenTimeToLiveSufficient(AccessToken token) {
|
||||||
|
return token != null && (token.getExpiration() - this.deployment.getTokenMinimumTimeToLive()) > Time.currentTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
public KeycloakDeployment getDeployment() {
|
public KeycloakDeployment getDeployment() {
|
||||||
@@ -95,7 +101,7 @@ public class RefreshableKeycloakSecurityContext extends KeycloakSecurityContext
|
|||||||
if (log.isTraceEnabled()) {
|
if (log.isTraceEnabled()) {
|
||||||
log.trace("checking whether to refresh.");
|
log.trace("checking whether to refresh.");
|
||||||
}
|
}
|
||||||
if (isActive()) return true;
|
if (isActive() && isTokenTimeToLiveSufficient(this.token)) return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.deployment == null || refreshToken == null) return false; // Might be serialized in HttpSession?
|
if (this.deployment == null || refreshToken == null) return false; // Might be serialized in HttpSession?
|
||||||
@@ -130,6 +136,13 @@ public class RefreshableKeycloakSecurityContext extends KeycloakSecurityContext
|
|||||||
log.error("failed verification of token");
|
log.error("failed verification of token");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the TTL is greater-or-equal to the expire time on the refreshed token, have to abort or go into an infinite refresh loop
|
||||||
|
if (!isTokenTimeToLiveSufficient(token)) {
|
||||||
|
log.error("failed to refresh the token with a longer time-to-live than the minimum");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (response.getNotBeforePolicy() > deployment.getNotBefore()) {
|
if (response.getNotBeforePolicy() > deployment.getNotBefore()) {
|
||||||
deployment.setNotBefore(response.getNotBeforePolicy());
|
deployment.setNotBefore(response.getNotBeforePolicy());
|
||||||
}
|
}
|
||||||
@@ -145,4 +158,8 @@ public class RefreshableKeycloakSecurityContext extends KeycloakSecurityContext
|
|||||||
tokenStore.refreshCallback(this);
|
tokenStore.refreshCallback(this);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAuthorizationContext(AuthorizationContext authorizationContext) {
|
||||||
|
this.authorizationContext = authorizationContext;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+256
@@ -0,0 +1,256 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||||
|
* and other contributors as indicated by the @author tags.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.keycloak.adapters.authorization;
|
||||||
|
|
||||||
|
import org.jboss.logging.Logger;
|
||||||
|
import org.keycloak.AuthorizationContext;
|
||||||
|
import org.keycloak.adapters.OIDCHttpFacade;
|
||||||
|
import org.keycloak.adapters.spi.HttpFacade.Request;
|
||||||
|
import org.keycloak.adapters.spi.HttpFacade.Response;
|
||||||
|
import org.keycloak.authorization.client.AuthzClient;
|
||||||
|
import org.keycloak.authorization.client.representation.ResourceRepresentation;
|
||||||
|
import org.keycloak.authorization.client.resource.ProtectedResource;
|
||||||
|
import org.keycloak.representations.AccessToken;
|
||||||
|
import org.keycloak.representations.adapters.config.PolicyEnforcerConfig;
|
||||||
|
import org.keycloak.representations.adapters.config.PolicyEnforcerConfig.EnforcementMode;
|
||||||
|
import org.keycloak.representations.adapters.config.PolicyEnforcerConfig.PathConfig;
|
||||||
|
import org.keycloak.representations.authorization.Permission;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
|
||||||
|
*/
|
||||||
|
public abstract class AbstractPolicyEnforcer {
|
||||||
|
|
||||||
|
private static Logger LOGGER = Logger.getLogger(AbstractPolicyEnforcer.class);
|
||||||
|
private final PolicyEnforcerConfig enforcerConfig;
|
||||||
|
private final PolicyEnforcer policyEnforcer;
|
||||||
|
|
||||||
|
private List<PathConfig> paths;
|
||||||
|
private AuthzClient authzClient;
|
||||||
|
private PathMatcher pathMatcher;
|
||||||
|
|
||||||
|
public AbstractPolicyEnforcer(PolicyEnforcer policyEnforcer) {
|
||||||
|
this.policyEnforcer = policyEnforcer;
|
||||||
|
this.enforcerConfig = policyEnforcer.getEnforcerConfig();
|
||||||
|
this.authzClient = policyEnforcer.getClient();
|
||||||
|
this.pathMatcher = new PathMatcher();
|
||||||
|
this.paths = policyEnforcer.getPaths();
|
||||||
|
}
|
||||||
|
|
||||||
|
public AuthorizationContext authorize(OIDCHttpFacade httpFacade) {
|
||||||
|
EnforcementMode enforcementMode = this.enforcerConfig.getEnforcementMode();
|
||||||
|
|
||||||
|
if (EnforcementMode.DISABLED.equals(enforcementMode)) {
|
||||||
|
return createEmptyAuthorizationContext(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
AccessToken accessToken = httpFacade.getSecurityContext().getToken();
|
||||||
|
Request request = httpFacade.getRequest();
|
||||||
|
Response response = httpFacade.getResponse();
|
||||||
|
String pathInfo = URI.create(request.getURI()).getPath().substring(1);
|
||||||
|
String path = pathInfo.substring(pathInfo.indexOf('/'), pathInfo.length());
|
||||||
|
PathConfig pathConfig = this.pathMatcher.matches(path, this.paths);
|
||||||
|
|
||||||
|
LOGGER.debugf("Checking permissions for path [%s] with config [%s].", request.getURI(), pathConfig);
|
||||||
|
|
||||||
|
if (pathConfig == null) {
|
||||||
|
if (EnforcementMode.PERMISSIVE.equals(enforcementMode)) {
|
||||||
|
return createAuthorizationContext(accessToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOGGER.debugf("Could not find a configuration for path [%s]", path);
|
||||||
|
response.sendError(403, "Could not find a configuration for path [" + path + "].");
|
||||||
|
|
||||||
|
return createEmptyAuthorizationContext(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
PathConfig actualPathConfig = resolvePathConfig(pathConfig, request);
|
||||||
|
Set<String> requiredScopes = getRequiredScopes(actualPathConfig, request);
|
||||||
|
|
||||||
|
if (isAuthorized(actualPathConfig, requiredScopes, accessToken, httpFacade)) {
|
||||||
|
try {
|
||||||
|
return createAuthorizationContext(accessToken);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("Error processing path [" + actualPathConfig.getPath() + "].", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!challenge(actualPathConfig, requiredScopes, httpFacade)) {
|
||||||
|
LOGGER.debugf("Sending challenge to the client. Path [%s]", pathConfig);
|
||||||
|
response.sendError(403, "Authorization failed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return createEmptyAuthorizationContext(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract boolean challenge(PathConfig pathConfig, Set<String> requiredScopes, OIDCHttpFacade facade);
|
||||||
|
|
||||||
|
protected boolean isAuthorized(PathConfig actualPathConfig, Set<String> requiredScopes, AccessToken accessToken, OIDCHttpFacade httpFacade) {
|
||||||
|
Request request = httpFacade.getRequest();
|
||||||
|
PolicyEnforcerConfig enforcerConfig = getEnforcerConfig();
|
||||||
|
String accessDeniedPath = enforcerConfig.getAccessDeniedPath();
|
||||||
|
|
||||||
|
if (accessDeniedPath != null) {
|
||||||
|
if (request.getURI().contains(accessDeniedPath)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AccessToken.Authorization authorization = accessToken.getAuthorization();
|
||||||
|
|
||||||
|
if (authorization == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Permission> permissions = authorization.getPermissions();
|
||||||
|
|
||||||
|
for (Permission permission : permissions) {
|
||||||
|
Set<String> allowedScopes = permission.getScopes();
|
||||||
|
|
||||||
|
if (permission.getResourceSetId() != null) {
|
||||||
|
if (isResourcePermission(actualPathConfig, permission)) {
|
||||||
|
if (((allowedScopes == null || allowedScopes.isEmpty()) && requiredScopes.isEmpty()) || allowedScopes.containsAll(requiredScopes)) {
|
||||||
|
LOGGER.debugf("Authorization GRANTED for path [%s]. Permissions [%s].", actualPathConfig, permissions);
|
||||||
|
if (request.getMethod().equalsIgnoreCase("DELETE") && actualPathConfig.isInstance()) {
|
||||||
|
this.paths.remove(actualPathConfig);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ((allowedScopes.isEmpty() && requiredScopes.isEmpty()) || allowedScopes.containsAll(requiredScopes)) {
|
||||||
|
LOGGER.debugf("Authorization GRANTED for path [%s]. Permissions [%s].", actualPathConfig, permissions);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOGGER.debugf("Authorization FAILED for path [%s]. No enough permissions [%s].", actualPathConfig, permissions);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected AuthzClient getAuthzClient() {
|
||||||
|
return this.authzClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected PolicyEnforcerConfig getEnforcerConfig() {
|
||||||
|
return enforcerConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected PolicyEnforcer getPolicyEnforcer() {
|
||||||
|
return policyEnforcer;
|
||||||
|
}
|
||||||
|
|
||||||
|
private AuthorizationContext createEmptyAuthorizationContext(final boolean granted) {
|
||||||
|
return new AuthorizationContext() {
|
||||||
|
@Override
|
||||||
|
public boolean hasPermission(String resourceName, String scopeName) {
|
||||||
|
return granted;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasResourcePermission(String resourceName) {
|
||||||
|
return granted;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasScopePermission(String scopeName) {
|
||||||
|
return granted;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Permission> getPermissions() {
|
||||||
|
return Collections.EMPTY_LIST;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isGranted() {
|
||||||
|
return granted;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private PathConfig resolvePathConfig(PathConfig originalConfig, Request request) {
|
||||||
|
if (originalConfig.hasPattern()) {
|
||||||
|
String pathInfo = URI.create(request.getURI()).getPath().substring(1);
|
||||||
|
String path = pathInfo.substring(pathInfo.indexOf('/'), pathInfo.length());
|
||||||
|
ProtectedResource resource = this.authzClient.protection().resource();
|
||||||
|
Set<String> search = resource.findByFilter("uri=" + path);
|
||||||
|
|
||||||
|
if (!search.isEmpty()) {
|
||||||
|
// resource does exist on the server, cache it
|
||||||
|
ResourceRepresentation targetResource = resource.findById(search.iterator().next()).getResourceDescription();
|
||||||
|
PathConfig config = new PathConfig();
|
||||||
|
|
||||||
|
config.setId(targetResource.getId());
|
||||||
|
config.setName(targetResource.getName());
|
||||||
|
config.setType(targetResource.getType());
|
||||||
|
config.setPath(targetResource.getUri());
|
||||||
|
config.setScopes(originalConfig.getScopes());
|
||||||
|
config.setMethods(originalConfig.getMethods());
|
||||||
|
config.setInstance(true);
|
||||||
|
config.setParentConfig(originalConfig);
|
||||||
|
|
||||||
|
this.paths.add(config);
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return originalConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Set<String> getRequiredScopes(PathConfig pathConfig, Request request) {
|
||||||
|
Set<String> requiredScopes = new HashSet<>();
|
||||||
|
|
||||||
|
requiredScopes.addAll(pathConfig.getScopes());
|
||||||
|
|
||||||
|
String method = request.getMethod();
|
||||||
|
|
||||||
|
for (PolicyEnforcerConfig.MethodConfig methodConfig : pathConfig.getMethods()) {
|
||||||
|
if (methodConfig.getMethod().equals(method)) {
|
||||||
|
requiredScopes.addAll(methodConfig.getScopes());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return requiredScopes;
|
||||||
|
}
|
||||||
|
|
||||||
|
private AuthorizationContext createAuthorizationContext(AccessToken accessToken) {
|
||||||
|
return new AuthorizationContext(accessToken, this.paths);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isResourcePermission(PathConfig actualPathConfig, Permission permission) {
|
||||||
|
// first we try a match using resource id
|
||||||
|
boolean resourceMatch = permission.getResourceSetId().equals(actualPathConfig.getId());
|
||||||
|
|
||||||
|
// as a fallback, check if the current path is an instance and if so, check if parent's id matches the permission
|
||||||
|
if (!resourceMatch && actualPathConfig.isInstance()) {
|
||||||
|
resourceMatch = permission.getResourceSetId().equals(actualPathConfig.getParentConfig().getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
return resourceMatch;
|
||||||
|
}
|
||||||
|
}
|
||||||
+80
@@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||||
|
* and other contributors as indicated by the @author tags.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.keycloak.adapters.authorization;
|
||||||
|
|
||||||
|
import org.jboss.logging.Logger;
|
||||||
|
import org.keycloak.adapters.OIDCHttpFacade;
|
||||||
|
import org.keycloak.adapters.spi.HttpFacade;
|
||||||
|
import org.keycloak.authorization.client.AuthzClient;
|
||||||
|
import org.keycloak.authorization.client.representation.PermissionRequest;
|
||||||
|
import org.keycloak.authorization.client.resource.PermissionResource;
|
||||||
|
import org.keycloak.authorization.client.resource.ProtectionResource;
|
||||||
|
import org.keycloak.representations.adapters.config.PolicyEnforcerConfig.PathConfig;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
|
||||||
|
*/
|
||||||
|
public class BearerTokenPolicyEnforcer extends AbstractPolicyEnforcer {
|
||||||
|
|
||||||
|
private static Logger LOGGER = Logger.getLogger(BearerTokenPolicyEnforcer.class);
|
||||||
|
|
||||||
|
public BearerTokenPolicyEnforcer(PolicyEnforcer enforcer) {
|
||||||
|
super(enforcer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean challenge(PathConfig pathConfig, Set<String> requiredScopes, OIDCHttpFacade facade) {
|
||||||
|
if (getEnforcerConfig().getUmaProtocolConfig() != null) {
|
||||||
|
challengeUmaAuthentication(pathConfig, requiredScopes, facade);
|
||||||
|
} else {
|
||||||
|
challengeEntitlementAuthentication(facade);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void challengeEntitlementAuthentication(OIDCHttpFacade facade) {
|
||||||
|
HttpFacade.Response response = facade.getResponse();
|
||||||
|
AuthzClient authzClient = getAuthzClient();
|
||||||
|
String clientId = authzClient.getConfiguration().getClientId();
|
||||||
|
String authorizationServerUri = authzClient.getServerConfiguration().getIssuer().toString() + "/authz/entitlement";
|
||||||
|
response.setStatus(401);
|
||||||
|
response.setHeader("WWW-Authenticate", "KC_ETT realm=\"" + clientId + "\",as_uri=\"" + authorizationServerUri + "\"");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void challengeUmaAuthentication(PathConfig pathConfig, Set<String> requiredScopes, OIDCHttpFacade facade) {
|
||||||
|
HttpFacade.Response response = facade.getResponse();
|
||||||
|
AuthzClient authzClient = getAuthzClient();
|
||||||
|
String ticket = getPermissionTicket(pathConfig, requiredScopes, authzClient);
|
||||||
|
String clientId = authzClient.getConfiguration().getClientId();
|
||||||
|
String authorizationServerUri = authzClient.getServerConfiguration().getIssuer().toString() + "/authz/authorize";
|
||||||
|
response.setStatus(401);
|
||||||
|
response.setHeader("WWW-Authenticate", "UMA realm=\"" + clientId + "\",as_uri=\"" + authorizationServerUri + "\",ticket=\"" + ticket + "\"");
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getPermissionTicket(PathConfig pathConfig, Set<String> requiredScopes, AuthzClient authzClient) {
|
||||||
|
ProtectionResource protection = authzClient.protection();
|
||||||
|
PermissionResource permission = protection.permission();
|
||||||
|
PermissionRequest permissionRequest = new PermissionRequest();
|
||||||
|
permissionRequest.setResourceSetId(pathConfig.getId());
|
||||||
|
permissionRequest.setScopes(requiredScopes);
|
||||||
|
return permission.forResource(permissionRequest).getTicket();
|
||||||
|
}
|
||||||
|
}
|
||||||
+119
@@ -0,0 +1,119 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||||
|
* and other contributors as indicated by the @author tags.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.keycloak.adapters.authorization;
|
||||||
|
|
||||||
|
import org.jboss.logging.Logger;
|
||||||
|
import org.keycloak.RSATokenVerifier;
|
||||||
|
import org.keycloak.adapters.KeycloakDeployment;
|
||||||
|
import org.keycloak.adapters.OIDCHttpFacade;
|
||||||
|
import org.keycloak.adapters.spi.HttpFacade;
|
||||||
|
import org.keycloak.authorization.client.AuthorizationDeniedException;
|
||||||
|
import org.keycloak.authorization.client.AuthzClient;
|
||||||
|
import org.keycloak.authorization.client.representation.AuthorizationRequest;
|
||||||
|
import org.keycloak.authorization.client.representation.AuthorizationResponse;
|
||||||
|
import org.keycloak.authorization.client.representation.EntitlementResponse;
|
||||||
|
import org.keycloak.authorization.client.representation.PermissionRequest;
|
||||||
|
import org.keycloak.authorization.client.representation.PermissionResponse;
|
||||||
|
import org.keycloak.representations.AccessToken;
|
||||||
|
import org.keycloak.representations.adapters.config.PolicyEnforcerConfig.PathConfig;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
|
||||||
|
*/
|
||||||
|
public class KeycloakAdapterPolicyEnforcer extends AbstractPolicyEnforcer {
|
||||||
|
|
||||||
|
private static Logger LOGGER = Logger.getLogger(KeycloakAdapterPolicyEnforcer.class);
|
||||||
|
|
||||||
|
public KeycloakAdapterPolicyEnforcer(PolicyEnforcer policyEnforcer) {
|
||||||
|
super(policyEnforcer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isAuthorized(PathConfig pathConfig, Set<String> requiredScopes, AccessToken accessToken, OIDCHttpFacade httpFacade) {
|
||||||
|
int retry = 2;
|
||||||
|
AccessToken original = accessToken;
|
||||||
|
|
||||||
|
while (retry >= 0) {
|
||||||
|
if (super.isAuthorized(pathConfig, requiredScopes, accessToken, httpFacade)) {
|
||||||
|
original.setAuthorization(accessToken.getAuthorization());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
accessToken = requestAuthorizationToken(pathConfig, requiredScopes, httpFacade);
|
||||||
|
|
||||||
|
if (accessToken == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
retry--;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean challenge(PathConfig pathConfig, Set<String> requiredScopes, OIDCHttpFacade facade) {
|
||||||
|
String accessDeniedPath = getEnforcerConfig().getAccessDeniedPath();
|
||||||
|
HttpFacade.Response response = facade.getResponse();
|
||||||
|
|
||||||
|
if (accessDeniedPath != null) {
|
||||||
|
response.setStatus(302);
|
||||||
|
response.setHeader("Location", accessDeniedPath);
|
||||||
|
} else {
|
||||||
|
response.sendError(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private AccessToken requestAuthorizationToken(PathConfig pathConfig, Set<String> requiredScopes, OIDCHttpFacade httpFacade) {
|
||||||
|
try {
|
||||||
|
String accessToken = httpFacade.getSecurityContext().getTokenString();
|
||||||
|
AuthzClient authzClient = getAuthzClient();
|
||||||
|
KeycloakDeployment deployment = getPolicyEnforcer().getDeployment();
|
||||||
|
|
||||||
|
if (getEnforcerConfig().getUmaProtocolConfig() != null) {
|
||||||
|
LOGGER.debug("Obtaining authorization for authenticated user.");
|
||||||
|
PermissionRequest permissionRequest = new PermissionRequest();
|
||||||
|
|
||||||
|
permissionRequest.setResourceSetId(pathConfig.getId());
|
||||||
|
permissionRequest.setScopes(requiredScopes);
|
||||||
|
|
||||||
|
PermissionResponse permissionResponse = authzClient.protection().permission().forResource(permissionRequest);
|
||||||
|
AuthorizationRequest authzRequest = new AuthorizationRequest(permissionResponse.getTicket());
|
||||||
|
AuthorizationResponse authzResponse = authzClient.authorization(accessToken).authorize(authzRequest);
|
||||||
|
|
||||||
|
if (authzResponse != null) {
|
||||||
|
return RSATokenVerifier.verifyToken(authzResponse.getRpt(), deployment.getRealmKey(), deployment.getRealmInfoUrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
LOGGER.debug("Obtaining entitlements for authenticated user.");
|
||||||
|
EntitlementResponse authzResponse = authzClient.entitlement(accessToken).getAll(authzClient.getConfiguration().getClientId());
|
||||||
|
return RSATokenVerifier.verifyToken(authzResponse.getRpt(), deployment.getRealmKey(), deployment.getRealmInfoUrl());
|
||||||
|
}
|
||||||
|
} catch (AuthorizationDeniedException e) {
|
||||||
|
return null;
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("Unexpected error during authorization request.", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+103
@@ -0,0 +1,103 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||||
|
* and other contributors as indicated by the @author tags.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.keycloak.adapters.authorization;
|
||||||
|
|
||||||
|
import org.keycloak.representations.adapters.config.PolicyEnforcerConfig.PathConfig;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
|
||||||
|
*/
|
||||||
|
class PathMatcher {
|
||||||
|
|
||||||
|
private static final String ANY_RESOURCE_PATTERN = "/*";
|
||||||
|
|
||||||
|
PathConfig matches(final String requestedUri, List<PathConfig> paths) {
|
||||||
|
PathConfig actualConfig = null;
|
||||||
|
|
||||||
|
for (PathConfig entry : paths) {
|
||||||
|
String protectedUri = entry.getPath();
|
||||||
|
String selectedUri = null;
|
||||||
|
|
||||||
|
if (protectedUri.equals(ANY_RESOURCE_PATTERN) && actualConfig == null) {
|
||||||
|
selectedUri = protectedUri;
|
||||||
|
}
|
||||||
|
|
||||||
|
int suffixIndex = protectedUri.indexOf(ANY_RESOURCE_PATTERN + ".");
|
||||||
|
|
||||||
|
if (suffixIndex != -1) {
|
||||||
|
String protectedSuffix = protectedUri.substring(suffixIndex + ANY_RESOURCE_PATTERN.length());
|
||||||
|
|
||||||
|
if (requestedUri.endsWith(protectedSuffix)) {
|
||||||
|
selectedUri = protectedUri;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (protectedUri.equals(requestedUri)) {
|
||||||
|
selectedUri = protectedUri;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (protectedUri.endsWith(ANY_RESOURCE_PATTERN)) {
|
||||||
|
String formattedPattern = removeWildCardsFromUri(protectedUri);
|
||||||
|
|
||||||
|
if (!formattedPattern.equals("/") && requestedUri.startsWith(formattedPattern)) {
|
||||||
|
selectedUri = protectedUri;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!formattedPattern.equals("/") && formattedPattern.endsWith("/") && formattedPattern.substring(0, formattedPattern.length() - 1).equals(requestedUri)) {
|
||||||
|
selectedUri = protectedUri;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int startRegex = protectedUri.indexOf('{');
|
||||||
|
|
||||||
|
if (startRegex != -1) {
|
||||||
|
String prefix = protectedUri.substring(0, startRegex);
|
||||||
|
|
||||||
|
if (requestedUri.startsWith(prefix)) {
|
||||||
|
selectedUri = protectedUri;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedUri != null) {
|
||||||
|
selectedUri = protectedUri;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedUri != null) {
|
||||||
|
if (actualConfig == null) {
|
||||||
|
actualConfig = entry;
|
||||||
|
} else {
|
||||||
|
if (actualConfig.equals(ANY_RESOURCE_PATTERN)) {
|
||||||
|
actualConfig = entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (protectedUri.startsWith(removeWildCardsFromUri(actualConfig.getPath()))) {
|
||||||
|
actualConfig = entry;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return actualConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String removeWildCardsFromUri(String protectedUri) {
|
||||||
|
return protectedUri.replaceAll("/[*]", "/");
|
||||||
|
}
|
||||||
|
}
|
||||||
+205
@@ -0,0 +1,205 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||||
|
* and other contributors as indicated by the @author tags.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.keycloak.adapters.authorization;
|
||||||
|
|
||||||
|
import org.jboss.logging.Logger;
|
||||||
|
import org.keycloak.AuthorizationContext;
|
||||||
|
import org.keycloak.adapters.KeycloakDeployment;
|
||||||
|
import org.keycloak.adapters.OIDCHttpFacade;
|
||||||
|
import org.keycloak.authorization.client.AuthzClient;
|
||||||
|
import org.keycloak.authorization.client.Configuration;
|
||||||
|
import org.keycloak.authorization.client.representation.RegistrationResponse;
|
||||||
|
import org.keycloak.authorization.client.representation.ResourceRepresentation;
|
||||||
|
import org.keycloak.authorization.client.representation.ScopeRepresentation;
|
||||||
|
import org.keycloak.authorization.client.resource.ProtectedResource;
|
||||||
|
import org.keycloak.representations.adapters.config.AdapterConfig;
|
||||||
|
import org.keycloak.representations.adapters.config.PolicyEnforcerConfig;
|
||||||
|
import org.keycloak.representations.adapters.config.PolicyEnforcerConfig.PathConfig;
|
||||||
|
import org.keycloak.representations.authorization.Permission;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
|
||||||
|
*/
|
||||||
|
public class PolicyEnforcer {
|
||||||
|
|
||||||
|
private static Logger LOGGER = Logger.getLogger(PolicyEnforcer.class);
|
||||||
|
|
||||||
|
private final KeycloakDeployment deployment;
|
||||||
|
private final PathMatcher pathMatcher;
|
||||||
|
private final AuthzClient authzClient;
|
||||||
|
private final PolicyEnforcerConfig enforcerConfig;
|
||||||
|
private final List<PathConfig> paths;
|
||||||
|
|
||||||
|
public PolicyEnforcer(KeycloakDeployment deployment, AdapterConfig adapterConfig) {
|
||||||
|
this.deployment = deployment;
|
||||||
|
this.enforcerConfig = adapterConfig.getPolicyEnforcerConfig();
|
||||||
|
this.authzClient = AuthzClient.create(new Configuration(adapterConfig.getAuthServerUrl(), adapterConfig.getRealm(), adapterConfig.getResource(), adapterConfig.getCredentials(), deployment.getClient()));
|
||||||
|
this.pathMatcher = new PathMatcher();
|
||||||
|
this.paths = configurePaths(this.authzClient.protection().resource(), this.enforcerConfig);
|
||||||
|
|
||||||
|
if (LOGGER.isDebugEnabled()) {
|
||||||
|
LOGGER.debug("Initialization complete. Path configurations:");
|
||||||
|
for (PathConfig pathConfig : this.paths) {
|
||||||
|
LOGGER.debug(pathConfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public AuthorizationContext enforce(OIDCHttpFacade facade) {
|
||||||
|
if (LOGGER.isDebugEnabled()) {
|
||||||
|
LOGGER.debugv("Policy enforcement is enable. Enforcing policy decisions for path [{0}].", facade.getRequest().getURI());
|
||||||
|
}
|
||||||
|
|
||||||
|
AuthorizationContext context;
|
||||||
|
|
||||||
|
if (deployment.isBearerOnly()) {
|
||||||
|
context = new BearerTokenPolicyEnforcer(this).authorize(facade);
|
||||||
|
} else {
|
||||||
|
context = new KeycloakAdapterPolicyEnforcer(this).authorize(facade);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LOGGER.isDebugEnabled()) {
|
||||||
|
LOGGER.debugv("Policy enforcement result for path [{0}] is : {1}", facade.getRequest().getURI(), context.isGranted() ? "GRANTED" : "DENIED");
|
||||||
|
LOGGER.debugv("Returning authorization context with permissions:");
|
||||||
|
for (Permission permission : context.getPermissions()) {
|
||||||
|
LOGGER.debug(permission);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
PolicyEnforcerConfig getEnforcerConfig() {
|
||||||
|
return enforcerConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
AuthzClient getClient() {
|
||||||
|
return authzClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PathConfig> getPaths() {
|
||||||
|
return paths;
|
||||||
|
}
|
||||||
|
|
||||||
|
KeycloakDeployment getDeployment() {
|
||||||
|
return deployment;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<PathConfig> configurePaths(ProtectedResource protectedResource, PolicyEnforcerConfig enforcerConfig) {
|
||||||
|
if (enforcerConfig.getPaths().isEmpty()) {
|
||||||
|
LOGGER.info("No path provided in configuration.");
|
||||||
|
return configureAllPathsForResourceServer(protectedResource);
|
||||||
|
} else {
|
||||||
|
LOGGER.info("Paths provided in configuration.");
|
||||||
|
return configureDefinedPaths(protectedResource, enforcerConfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<PathConfig> configureDefinedPaths(ProtectedResource protectedResource, PolicyEnforcerConfig enforcerConfig) {
|
||||||
|
List<PathConfig> paths = new ArrayList<>();
|
||||||
|
|
||||||
|
for (PathConfig pathConfig : enforcerConfig.getPaths()) {
|
||||||
|
Set<String> search;
|
||||||
|
String resourceName = pathConfig.getName();
|
||||||
|
String path = pathConfig.getPath();
|
||||||
|
|
||||||
|
if (resourceName != null) {
|
||||||
|
LOGGER.debugf("Trying to find resource with name [%s] for path [%s].", resourceName, path);
|
||||||
|
search = protectedResource.findByFilter("name=" + resourceName);
|
||||||
|
} else {
|
||||||
|
LOGGER.debugf("Trying to find resource with uri [%s] for path [%s].", path, path);
|
||||||
|
search = protectedResource.findByFilter("uri=" + path);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (search.isEmpty()) {
|
||||||
|
if (enforcerConfig.isCreateResources()) {
|
||||||
|
LOGGER.debugf("Creating resource on server for path [%s].", pathConfig);
|
||||||
|
ResourceRepresentation resource = new ResourceRepresentation();
|
||||||
|
|
||||||
|
resource.setName(resourceName);
|
||||||
|
resource.setType(pathConfig.getType());
|
||||||
|
resource.setUri(path);
|
||||||
|
|
||||||
|
HashSet<ScopeRepresentation> scopes = new HashSet<>();
|
||||||
|
|
||||||
|
for (String scopeName : pathConfig.getScopes()) {
|
||||||
|
ScopeRepresentation scope = new ScopeRepresentation();
|
||||||
|
|
||||||
|
scope.setName(scopeName);
|
||||||
|
|
||||||
|
scopes.add(scope);
|
||||||
|
}
|
||||||
|
|
||||||
|
resource.setScopes(scopes);
|
||||||
|
|
||||||
|
RegistrationResponse registrationResponse = protectedResource.create(resource);
|
||||||
|
|
||||||
|
pathConfig.setId(registrationResponse.getId());
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("Could not find matching resource on server with uri [" + path + "] or name [" + resourceName + ". Make sure you have created a resource on the server that matches with the path configuration.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pathConfig.setId(search.iterator().next());
|
||||||
|
}
|
||||||
|
|
||||||
|
paths.add(pathConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
return paths;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<PathConfig> configureAllPathsForResourceServer(ProtectedResource protectedResource) {
|
||||||
|
LOGGER.info("Querying the server for all resources associated with this application.");
|
||||||
|
List<PathConfig> paths = new ArrayList<>();
|
||||||
|
|
||||||
|
for (String id : protectedResource.findAll()) {
|
||||||
|
RegistrationResponse response = protectedResource.findById(id);
|
||||||
|
ResourceRepresentation resourceDescription = response.getResourceDescription();
|
||||||
|
|
||||||
|
if (resourceDescription.getUri() != null) {
|
||||||
|
paths.add(createPathConfig(resourceDescription));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return paths;
|
||||||
|
}
|
||||||
|
|
||||||
|
private PathConfig createPathConfig(ResourceRepresentation resourceDescription) {
|
||||||
|
PathConfig pathConfig = new PathConfig();
|
||||||
|
|
||||||
|
pathConfig.setId(resourceDescription.getId());
|
||||||
|
pathConfig.setName(resourceDescription.getName());
|
||||||
|
pathConfig.setPath(resourceDescription.getUri());
|
||||||
|
|
||||||
|
List<String> scopeNames = new ArrayList<>();
|
||||||
|
|
||||||
|
for (ScopeRepresentation scope : resourceDescription.getScopes()) {
|
||||||
|
scopeNames.add(scope.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
pathConfig.setScopes(scopeNames);
|
||||||
|
pathConfig.setType(resourceDescription.getType());
|
||||||
|
|
||||||
|
return pathConfig;
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-2
@@ -38,13 +38,13 @@ import javax.security.auth.spi.LoginModule;
|
|||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
import org.keycloak.KeycloakPrincipal;
|
import org.keycloak.KeycloakPrincipal;
|
||||||
import org.keycloak.RSATokenVerifier;
|
import org.keycloak.RSATokenVerifier;
|
||||||
import org.keycloak.common.VerificationException;
|
|
||||||
import org.keycloak.adapters.AdapterDeploymentContext;
|
import org.keycloak.adapters.AdapterDeploymentContext;
|
||||||
import org.keycloak.adapters.AdapterUtils;
|
import org.keycloak.adapters.AdapterUtils;
|
||||||
import org.keycloak.common.util.FindFile;
|
|
||||||
import org.keycloak.adapters.KeycloakDeployment;
|
import org.keycloak.adapters.KeycloakDeployment;
|
||||||
import org.keycloak.adapters.KeycloakDeploymentBuilder;
|
import org.keycloak.adapters.KeycloakDeploymentBuilder;
|
||||||
import org.keycloak.adapters.RefreshableKeycloakSecurityContext;
|
import org.keycloak.adapters.RefreshableKeycloakSecurityContext;
|
||||||
|
import org.keycloak.common.VerificationException;
|
||||||
|
import org.keycloak.common.util.FindFile;
|
||||||
import org.keycloak.representations.AccessToken;
|
import org.keycloak.representations.AccessToken;
|
||||||
import org.keycloak.common.util.reflections.Reflections;
|
import org.keycloak.common.util.reflections.Reflections;
|
||||||
|
|
||||||
|
|||||||
Regular → Executable
File mode changed.
Regular → Executable
File mode changed.
+2
-1
@@ -54,13 +54,14 @@ public class KeycloakDeploymentBuilderTest {
|
|||||||
assertEquals("234234-234234-234234", deployment.getResourceCredentials().get("secret"));
|
assertEquals("234234-234234-234234", deployment.getResourceCredentials().get("secret"));
|
||||||
assertEquals(ClientIdAndSecretCredentialsProvider.PROVIDER_ID, deployment.getClientAuthenticator().getId());
|
assertEquals(ClientIdAndSecretCredentialsProvider.PROVIDER_ID, deployment.getClientAuthenticator().getId());
|
||||||
assertEquals(20, ((ThreadSafeClientConnManager) deployment.getClient().getConnectionManager()).getMaxTotal());
|
assertEquals(20, ((ThreadSafeClientConnManager) deployment.getClient().getConnectionManager()).getMaxTotal());
|
||||||
assertEquals("https://backend:8443/auth/realms/demo/protocol/openid-connect/token", deployment.getTokenUrl());
|
assertEquals("https://localhost:8443/auth/realms/demo/protocol/openid-connect/token", deployment.getTokenUrl());
|
||||||
assertEquals(RelativeUrlsUsed.NEVER, deployment.getRelativeUrls());
|
assertEquals(RelativeUrlsUsed.NEVER, deployment.getRelativeUrls());
|
||||||
assertTrue(deployment.isAlwaysRefreshToken());
|
assertTrue(deployment.isAlwaysRefreshToken());
|
||||||
assertTrue(deployment.isRegisterNodeAtStartup());
|
assertTrue(deployment.isRegisterNodeAtStartup());
|
||||||
assertEquals(1000, deployment.getRegisterNodePeriod());
|
assertEquals(1000, deployment.getRegisterNodePeriod());
|
||||||
assertEquals(TokenStore.COOKIE, deployment.getTokenStore());
|
assertEquals(TokenStore.COOKIE, deployment.getTokenStore());
|
||||||
assertEquals("email", deployment.getPrincipalAttribute());
|
assertEquals("email", deployment.getPrincipalAttribute());
|
||||||
|
assertEquals(10, deployment.getTokenMinimumTimeToLive());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
package org.keycloak.adapters;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.keycloak.representations.oidc.TokenMetadataRepresentation;
|
||||||
|
/**
|
||||||
|
* @author github.com/tubbynl
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class RefreshableKeycloakSecurityContextTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isActive() {
|
||||||
|
TokenMetadataRepresentation token = new TokenMetadataRepresentation();
|
||||||
|
token.setActive(true);
|
||||||
|
token.issuedNow();
|
||||||
|
RefreshableKeycloakSecurityContext sut = new RefreshableKeycloakSecurityContext(null,null,null,token,null, null, null);
|
||||||
|
|
||||||
|
// verify false if null deployment (KEYCLOAK-3050; yielded a npe)
|
||||||
|
assertFalse(sut.isActive());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,10 +24,10 @@
|
|||||||
"client-keystore": "classpath:/keystore.jks",
|
"client-keystore": "classpath:/keystore.jks",
|
||||||
"client-keystore-password": "storepass",
|
"client-keystore-password": "storepass",
|
||||||
"client-key-password": "keypass",
|
"client-key-password": "keypass",
|
||||||
"auth-server-url-for-backend-requests": "https://backend:8443/auth",
|
|
||||||
"always-refresh-token": true,
|
"always-refresh-token": true,
|
||||||
"register-node-at-startup": true,
|
"register-node-at-startup": true,
|
||||||
"register-node-period": 1000,
|
"register-node-period": 1000,
|
||||||
"token-store": "cookie",
|
"token-store": "cookie",
|
||||||
"principal-attribute": "email"
|
"principal-attribute": "email",
|
||||||
|
"token-minimum-time-to-live": 10
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-as7-integration-pom</artifactId>
|
<artifactId>keycloak-as7-integration-pom</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-as7-integration-pom</artifactId>
|
<artifactId>keycloak-as7-integration-pom</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-as7-integration-pom</artifactId>
|
<artifactId>keycloak-as7-integration-pom</artifactId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<name>Keycloak AS7 / JBoss EAP 6 Integration</name>
|
<name>Keycloak AS7 / JBoss EAP 6 Integration</name>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-jetty-adapter-spi</artifactId>
|
<artifactId>keycloak-jetty-adapter-spi</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-adapter-core</artifactId>
|
<artifactId>keycloak-adapter-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<name>Keycloak Jetty Integration</name>
|
<name>Keycloak Jetty Integration</name>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@@ -58,6 +58,25 @@
|
|||||||
<goal>minify</goal>
|
<goal>minify</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>min-authz-js</id>
|
||||||
|
<phase>compile</phase>
|
||||||
|
<configuration>
|
||||||
|
<charset>utf-8</charset>
|
||||||
|
<webappSourceDir>${basedir}/src/main/resources</webappSourceDir>
|
||||||
|
<jsSourceDir>.</jsSourceDir>
|
||||||
|
<jsSourceFiles>
|
||||||
|
<jsSourceFile>keycloak-authz.js</jsSourceFile>
|
||||||
|
</jsSourceFiles>
|
||||||
|
|
||||||
|
<webappTargetDir>${project.build.directory}/classes</webappTargetDir>
|
||||||
|
<jsTargetDir>.</jsTargetDir>
|
||||||
|
<jsFinalFile>keycloak-authz.js</jsFinalFile>
|
||||||
|
</configuration>
|
||||||
|
<goals>
|
||||||
|
<goal>minify</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
|||||||
@@ -0,0 +1,170 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||||
|
* and other contributors as indicated by the @author tags.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function( window, undefined ) {
|
||||||
|
|
||||||
|
var KeycloakAuthorization = function (keycloak) {
|
||||||
|
var _instance = this;
|
||||||
|
this.rpt = null;
|
||||||
|
|
||||||
|
this.init = function () {
|
||||||
|
var request = new XMLHttpRequest();
|
||||||
|
|
||||||
|
request.open('GET', keycloak.authServerUrl + '/realms/' + keycloak.realm + '/.well-known/uma-configuration');
|
||||||
|
request.onreadystatechange = function () {
|
||||||
|
if (request.readyState == 4) {
|
||||||
|
if (request.status == 200) {
|
||||||
|
_instance.config = JSON.parse(request.responseText);
|
||||||
|
} else {
|
||||||
|
console.error('Could not obtain configuration from server.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
request.send(null);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method enables client applications to better integrate with resource servers protected by a Keycloak
|
||||||
|
* policy enforcer.
|
||||||
|
*
|
||||||
|
* In this case, the resource server will respond with a 401 status code and a WWW-Authenticate header holding the
|
||||||
|
* necessary information to ask a Keycloak server for authorization data using both UMA and Entitlement protocol,
|
||||||
|
* depending on how the policy enforcer at the resource server was configured.
|
||||||
|
*/
|
||||||
|
this.authorize = function (wwwAuthenticateHeader) {
|
||||||
|
this.then = function (onGrant, onDeny, onError) {
|
||||||
|
if (wwwAuthenticateHeader.startsWith('UMA')) {
|
||||||
|
var params = wwwAuthenticateHeader.split(',');
|
||||||
|
|
||||||
|
for (i = 0; i < params.length; i++) {
|
||||||
|
var param = params[i].split('=');
|
||||||
|
|
||||||
|
if (param[0] == 'ticket') {
|
||||||
|
var request = new XMLHttpRequest();
|
||||||
|
|
||||||
|
request.open('POST', _instance.config.rpt_endpoint, true);
|
||||||
|
request.setRequestHeader('Content-Type', 'application/json')
|
||||||
|
request.setRequestHeader('Authorization', 'Bearer ' + keycloak.token)
|
||||||
|
|
||||||
|
request.onreadystatechange = function () {
|
||||||
|
if (request.readyState == 4) {
|
||||||
|
var status = request.status;
|
||||||
|
|
||||||
|
if (status >= 200 && status < 300) {
|
||||||
|
var rpt = JSON.parse(request.responseText).rpt;
|
||||||
|
_instance.rpt = rpt;
|
||||||
|
onGrant(rpt);
|
||||||
|
} else if (status == 403) {
|
||||||
|
if (onDeny) {
|
||||||
|
onDeny();
|
||||||
|
} else {
|
||||||
|
console.error('Authorization request was denied by the server.');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (onError) {
|
||||||
|
onError();
|
||||||
|
} else {
|
||||||
|
console.error('Could not obtain authorization data from server.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var ticket = param[1].substring(1, param[1].length - 1).trim();
|
||||||
|
|
||||||
|
request.send(JSON.stringify(
|
||||||
|
{
|
||||||
|
ticket: ticket,
|
||||||
|
rpt: _instance.rpt
|
||||||
|
}
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (wwwAuthenticateHeader.startsWith('KC_ETT')) {
|
||||||
|
var params = wwwAuthenticateHeader.substring('KC_ETT'.length).trim().split(',');
|
||||||
|
var clientId = null;
|
||||||
|
|
||||||
|
for (i = 0; i < params.length; i++) {
|
||||||
|
var param = params[i].split('=');
|
||||||
|
|
||||||
|
if (param[0] == 'realm') {
|
||||||
|
clientId = param[1].substring(1, param[1].length - 1).trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_instance.entitlement(clientId).then(onGrant, onDeny, onError);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obtains all entitlements from a Keycloak Server based on a give resourceServerId.
|
||||||
|
*/
|
||||||
|
this.entitlement = function (resourceSeververId) {
|
||||||
|
this.then = function (onGrant, onDeny, onError) {
|
||||||
|
var request = new XMLHttpRequest();
|
||||||
|
|
||||||
|
request.open('GET', keycloak.authServerUrl + '/realms/' + keycloak.realm + '/authz/entitlement/' + resourceSeververId, true);
|
||||||
|
request.setRequestHeader('Authorization', 'Bearer ' + keycloak.token)
|
||||||
|
|
||||||
|
request.onreadystatechange = function () {
|
||||||
|
if (request.readyState == 4) {
|
||||||
|
var status = request.status;
|
||||||
|
|
||||||
|
if (status >= 200 && status < 300) {
|
||||||
|
var rpt = JSON.parse(request.responseText).rpt;
|
||||||
|
_instance.rpt = rpt;
|
||||||
|
onGrant(rpt);
|
||||||
|
} else if (status == 403) {
|
||||||
|
if (onDeny) {
|
||||||
|
onDeny();
|
||||||
|
} else {
|
||||||
|
console.error('Authorization request was denied by the server.');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (onError) {
|
||||||
|
onError();
|
||||||
|
} else {
|
||||||
|
console.error('Could not obtain authorization data from server.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
request.send(null);
|
||||||
|
};
|
||||||
|
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.init(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
if ( typeof module === "object" && module && typeof module.exports === "object" ) {
|
||||||
|
module.exports = KeycloakAuthorization;
|
||||||
|
} else {
|
||||||
|
window.KeycloakAuthorization = KeycloakAuthorization;
|
||||||
|
|
||||||
|
if ( typeof define === "function" && define.amd ) {
|
||||||
|
define( "keycloak-authorization", [], function () { return KeycloakAuthorization; } );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})( window );
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
var kc = this;
|
var kc = this;
|
||||||
var adapter;
|
var adapter;
|
||||||
var refreshQueue = [];
|
var refreshQueue = [];
|
||||||
|
var storage;
|
||||||
|
|
||||||
var loginIframe = {
|
var loginIframe = {
|
||||||
enable: true,
|
enable: true,
|
||||||
@@ -35,10 +36,18 @@
|
|||||||
kc.init = function (initOptions) {
|
kc.init = function (initOptions) {
|
||||||
kc.authenticated = false;
|
kc.authenticated = false;
|
||||||
|
|
||||||
if (window.Cordova) {
|
storage = new PersistentStorage();
|
||||||
adapter = loadAdapter('cordova');
|
|
||||||
} else {
|
if (initOptions && initOptions.adapter === 'cordova') {
|
||||||
|
adapter = loadAdapter('cordova');
|
||||||
|
} else if (initOptions && initOptions.adapter === 'default') {
|
||||||
adapter = loadAdapter();
|
adapter = loadAdapter();
|
||||||
|
} else {
|
||||||
|
if (window.Cordova) {
|
||||||
|
adapter = loadAdapter('cordova');
|
||||||
|
} else {
|
||||||
|
adapter = loadAdapter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (initOptions) {
|
if (initOptions) {
|
||||||
@@ -163,6 +172,8 @@
|
|||||||
}
|
}
|
||||||
} else if (initOptions.onLoad) {
|
} else if (initOptions.onLoad) {
|
||||||
onLoad();
|
onLoad();
|
||||||
|
} else {
|
||||||
|
initPromise.setSuccess();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
initPromise.setSuccess();
|
initPromise.setSuccess();
|
||||||
@@ -190,7 +201,7 @@
|
|||||||
redirectUri += (redirectUri.indexOf('?') == -1 ? '?' : '&') + 'prompt=' + options.prompt;
|
redirectUri += (redirectUri.indexOf('?') == -1 ? '?' : '&') + 'prompt=' + options.prompt;
|
||||||
}
|
}
|
||||||
|
|
||||||
sessionStorage.oauthState = JSON.stringify({ state: state, nonce: nonce, redirectUri: encodeURIComponent(redirectUri) });
|
storage.setItem('oauthState', JSON.stringify({ state: state, nonce: nonce, redirectUri: encodeURIComponent(redirectUri) }));
|
||||||
|
|
||||||
var action = 'auth';
|
var action = 'auth';
|
||||||
if (options && options.action == 'register') {
|
if (options && options.action == 'register') {
|
||||||
@@ -687,10 +698,11 @@
|
|||||||
function parseCallback(url) {
|
function parseCallback(url) {
|
||||||
var oauth = new CallbackParser(url, kc.responseMode).parseUri();
|
var oauth = new CallbackParser(url, kc.responseMode).parseUri();
|
||||||
|
|
||||||
var sessionState = sessionStorage.oauthState && JSON.parse(sessionStorage.oauthState);
|
var oauthState = storage.getItem('oauthState');
|
||||||
|
var sessionState = oauthState && JSON.parse(oauthState);
|
||||||
|
|
||||||
if (sessionState && (oauth.code || oauth.error || oauth.access_token || oauth.id_token) && oauth.state && oauth.state == sessionState.state) {
|
if (sessionState && (oauth.code || oauth.error || oauth.access_token || oauth.id_token) && oauth.state && oauth.state == sessionState.state) {
|
||||||
delete sessionStorage.oauthState;
|
storage.removeItem('oauthState');
|
||||||
|
|
||||||
oauth.redirectUri = sessionState.redirectUri;
|
oauth.redirectUri = sessionState.redirectUri;
|
||||||
oauth.storedNonce = sessionState.nonce;
|
oauth.storedNonce = sessionState.nonce;
|
||||||
@@ -971,6 +983,82 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var PersistentStorage = function() {
|
||||||
|
if (!(this instanceof PersistentStorage)) {
|
||||||
|
return new PersistentStorage();
|
||||||
|
}
|
||||||
|
var ps = this;
|
||||||
|
var useCookieStorage = function () {
|
||||||
|
if (typeof localStorage === "undefined") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
var key = '@@keycloak-session-storage/test';
|
||||||
|
localStorage.setItem(key, 'test');
|
||||||
|
localStorage.removeItem(key);
|
||||||
|
return false;
|
||||||
|
} catch (err) {
|
||||||
|
// Probably in Safari "private mode" where localStorage
|
||||||
|
// quota is 0, or quota exceeded. Switching to cookie
|
||||||
|
// storage.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ps.setItem = function(key, value) {
|
||||||
|
if (useCookieStorage()) {
|
||||||
|
setCookie(key, value, cookieExpiration(5));
|
||||||
|
} else {
|
||||||
|
localStorage.setItem(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ps.getItem = function(key) {
|
||||||
|
if (useCookieStorage()) {
|
||||||
|
return getCookie(key);
|
||||||
|
}
|
||||||
|
return localStorage.getItem(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
ps.removeItem = function(key) {
|
||||||
|
if (typeof localStorage !== "undefined") {
|
||||||
|
try {
|
||||||
|
// Always try to delete from localStorage.
|
||||||
|
localStorage.removeItem(key);
|
||||||
|
} catch (err) { }
|
||||||
|
}
|
||||||
|
// Always remove the cookie.
|
||||||
|
setCookie(key, '', cookieExpiration(-100));
|
||||||
|
}
|
||||||
|
|
||||||
|
var cookieExpiration = function (minutes) {
|
||||||
|
var exp = new Date();
|
||||||
|
exp.setTime(exp.getTime() + (minutes*60*1000));
|
||||||
|
return exp;
|
||||||
|
}
|
||||||
|
|
||||||
|
var getCookie = function (key) {
|
||||||
|
var name = key + '=';
|
||||||
|
var ca = document.cookie.split(';');
|
||||||
|
for (var i = 0; i < ca.length; i++) {
|
||||||
|
var c = ca[i];
|
||||||
|
while (c.charAt(0) == ' ') {
|
||||||
|
c = c.substring(1);
|
||||||
|
}
|
||||||
|
if (c.indexOf(name) == 0) {
|
||||||
|
return c.substring(name.length, c.length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
var setCookie = function (key, value, expirationDate) {
|
||||||
|
var cookie = key + '=' + value + '; '
|
||||||
|
+ 'expires=' + expirationDate.toUTCString() + '; ';
|
||||||
|
document.cookie = cookie;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var CallbackParser = function(uriToParse, responseMode) {
|
var CallbackParser = function(uriToParse, responseMode) {
|
||||||
if (!(this instanceof CallbackParser)) {
|
if (!(this instanceof CallbackParser)) {
|
||||||
return new CallbackParser(uriToParse, responseMode);
|
return new CallbackParser(uriToParse, responseMode);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@@ -36,15 +36,32 @@
|
|||||||
org.keycloak.adapters.osgi.*
|
org.keycloak.adapters.osgi.*
|
||||||
</keycloak.osgi.export>
|
</keycloak.osgi.export>
|
||||||
<keycloak.osgi.import>
|
<keycloak.osgi.import>
|
||||||
org.ops4j.pax.web.*;version="[3.0,4)",
|
org.ops4j.pax.web.*;version="[3.0,5)",
|
||||||
javax.servlet.*;version="[2.5,4)";resolution:=optional,
|
javax.servlet.*;version="[2.5,4)";resolution:=optional,
|
||||||
org.eclipse.jetty.*;version="[8.1,10)";resolution:=optional,
|
org.eclipse.jetty.*;version="[8.1,10)";resolution:=optional,
|
||||||
org.keycloak.*;version="${project.version}",
|
org.keycloak.*;version="${project.version}",
|
||||||
|
org.apache.cxf.transport.http;resolution:=optional;version="[3,4)",
|
||||||
|
org.apache.cxf.transport.servlet;resolution:=optional;version="[3,4)",
|
||||||
*;resolution:=optional
|
*;resolution:=optional
|
||||||
</keycloak.osgi.import>
|
</keycloak.osgi.import>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<artifactId>keycloak-core</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<artifactId>keycloak-adapter-core</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<artifactId>keycloak-adapter-spi</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jboss.logging</groupId>
|
<groupId>org.jboss.logging</groupId>
|
||||||
<artifactId>jboss-logging</artifactId>
|
<artifactId>jboss-logging</artifactId>
|
||||||
@@ -65,12 +82,23 @@
|
|||||||
<artifactId>pax-web-runtime</artifactId>
|
<artifactId>pax-web-runtime</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.ops4j.pax.web</groupId>
|
||||||
|
<artifactId>pax-web-api</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
<artifactId>jetty-security</artifactId>
|
<artifactId>jetty-security</artifactId>
|
||||||
<version>${jetty9.version}</version>
|
<version>${jetty9.version}</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-transports-http</artifactId>
|
||||||
|
<version>${cxf.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
+71
@@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||||
|
* and other contributors as indicated by the @author tags.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.keycloak.adapters.osgi;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
import org.keycloak.adapters.KeycloakConfigResolver;
|
||||||
|
import org.keycloak.adapters.KeycloakDeployment;
|
||||||
|
import org.keycloak.adapters.KeycloakDeploymentBuilder;
|
||||||
|
import org.keycloak.adapters.OIDCHttpFacade;
|
||||||
|
|
||||||
|
public class PathBasedKeycloakConfigResolver implements KeycloakConfigResolver {
|
||||||
|
|
||||||
|
private final Map<String, KeycloakDeployment> cache = new ConcurrentHashMap<String, KeycloakDeployment>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeycloakDeployment resolve(OIDCHttpFacade.Request request) {
|
||||||
|
String path = request.getURI();
|
||||||
|
String[] urlTokens = path.split("/");
|
||||||
|
if (urlTokens.length < 4) {
|
||||||
|
throw new IllegalStateException("Not able to determine the web-context to load the correspondent keycloak.json file");
|
||||||
|
}
|
||||||
|
|
||||||
|
String webContext = urlTokens[3];
|
||||||
|
|
||||||
|
KeycloakDeployment deployment = cache.get(webContext);
|
||||||
|
if (null == deployment) {
|
||||||
|
// not found on the simple cache, try to load it from the file system
|
||||||
|
String keycloakConfig = (String) System.getProperties().get("keycloak.config");
|
||||||
|
if(keycloakConfig == null || "".equals(keycloakConfig.trim())){
|
||||||
|
String karafEtc = (String) System.getProperties().get("karaf.etc");
|
||||||
|
if(karafEtc == null || "".equals(karafEtc.trim())){
|
||||||
|
throw new IllegalStateException("Neither \"keycloak.config\" nor \"karaf.etc\" java properties are set. Please set one of them.");
|
||||||
|
}
|
||||||
|
keycloakConfig = karafEtc;
|
||||||
|
}
|
||||||
|
|
||||||
|
String absolutePath = keycloakConfig + File.separator + webContext + "-keycloak.json";
|
||||||
|
InputStream is = null;
|
||||||
|
try {
|
||||||
|
is = new FileInputStream(absolutePath);
|
||||||
|
} catch (FileNotFoundException e){
|
||||||
|
throw new IllegalStateException("Not able to find the file " + absolutePath);
|
||||||
|
}
|
||||||
|
deployment = KeycloakDeploymentBuilder.build(is);
|
||||||
|
cache.put(webContext, deployment);
|
||||||
|
}
|
||||||
|
|
||||||
|
return deployment;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+113
-27
@@ -18,15 +18,22 @@
|
|||||||
package org.keycloak.adapters.osgi;
|
package org.keycloak.adapters.osgi;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Dictionary;
|
||||||
|
import java.util.Enumeration;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
import javax.servlet.Servlet;
|
import javax.servlet.Servlet;
|
||||||
|
|
||||||
|
import org.apache.cxf.transport.http.DestinationRegistry;
|
||||||
|
import org.apache.cxf.transport.servlet.CXFNonSpringServlet;
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
import org.ops4j.pax.web.service.WebContainer;
|
import org.ops4j.pax.web.service.WebContainer;
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
import org.osgi.framework.ServiceReference;
|
import org.osgi.framework.ServiceReference;
|
||||||
|
import org.osgi.service.cm.Configuration;
|
||||||
|
import org.osgi.service.cm.ConfigurationAdmin;
|
||||||
import org.osgi.service.http.HttpContext;
|
import org.osgi.service.http.HttpContext;
|
||||||
import org.osgi.util.tracker.ServiceTracker;
|
import org.osgi.util.tracker.ServiceTracker;
|
||||||
import org.osgi.util.tracker.ServiceTrackerCustomizer;
|
import org.osgi.util.tracker.ServiceTrackerCustomizer;
|
||||||
@@ -42,13 +49,15 @@ import org.osgi.util.tracker.ServiceTrackerCustomizer;
|
|||||||
*/
|
*/
|
||||||
public class ServletReregistrationService {
|
public class ServletReregistrationService {
|
||||||
|
|
||||||
|
private static final String CXF_SERVLET_PREFIX = "org.apache.cxf.servlet.";
|
||||||
protected static final Logger log = Logger.getLogger(ServletReregistrationService.class);
|
protected static final Logger log = Logger.getLogger(ServletReregistrationService.class);
|
||||||
|
|
||||||
private static final List<String> FILTERED_PROPERTIES = Arrays.asList("objectClass", "service.id");
|
private static final List<String> FILTERED_PROPERTIES = Arrays.asList("objectClass", "service.id");
|
||||||
|
|
||||||
private BundleContext bundleContext;
|
private BundleContext bundleContext;
|
||||||
private ServiceReference servletReference;
|
private ServiceReference managedServiceReference;
|
||||||
private ServiceTracker webContainerTracker;
|
private ServiceTracker webContainerTracker;
|
||||||
|
private String alias;
|
||||||
|
|
||||||
public BundleContext getBundleContext() {
|
public BundleContext getBundleContext() {
|
||||||
return bundleContext;
|
return bundleContext;
|
||||||
@@ -58,24 +67,18 @@ public class ServletReregistrationService {
|
|||||||
this.bundleContext = bundleContext;
|
this.bundleContext = bundleContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServiceReference getServletReference() {
|
|
||||||
return servletReference;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setServletReference(ServiceReference servletReference) {
|
|
||||||
this.servletReference = servletReference;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ServiceTracker getWebContainerTracker() {
|
|
||||||
return webContainerTracker;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
if (servletReference == null) {
|
if ( managedServiceReference == null) {
|
||||||
throw new IllegalStateException("No servlet reference provided");
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary properties = obtainProperties();
|
||||||
|
alias = (String)getProp(properties, CXF_SERVLET_PREFIX + "context", "/cxf");
|
||||||
|
if(alias == null){
|
||||||
|
alias = "/cxf";
|
||||||
}
|
}
|
||||||
|
|
||||||
final Servlet servlet = (Servlet) bundleContext.getService(servletReference);
|
|
||||||
WebContainer externalWebContainer = findExternalWebContainer();
|
WebContainer externalWebContainer = findExternalWebContainer();
|
||||||
if (externalWebContainer == null) {
|
if (externalWebContainer == null) {
|
||||||
return;
|
return;
|
||||||
@@ -83,18 +86,19 @@ public class ServletReregistrationService {
|
|||||||
|
|
||||||
// Unregister servlet from external container now
|
// Unregister servlet from external container now
|
||||||
try {
|
try {
|
||||||
externalWebContainer.unregisterServlet(servlet);
|
externalWebContainer.unregister(alias);
|
||||||
log.debug("Original servlet with alias " + getAlias() + " unregistered successfully from external web container.");
|
log.debug("Original servlet with alias " + getAlias() + " unregistered successfully from external web container.");
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
log.warn("Can't unregister servlet due to: " + e.getMessage());
|
log.warn("Can't unregister servlet due to: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final Dictionary finalProperties = properties;
|
||||||
ServiceTrackerCustomizer trackerCustomizer = new ServiceTrackerCustomizer() {
|
ServiceTrackerCustomizer trackerCustomizer = new ServiceTrackerCustomizer() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object addingService(ServiceReference webContainerServiceReference) {
|
public Object addingService(ServiceReference webContainerServiceReference) {
|
||||||
WebContainer ourWebContainer = (WebContainer) bundleContext.getService(webContainerServiceReference);
|
WebContainer ourWebContainer = (WebContainer) bundleContext.getService(webContainerServiceReference);
|
||||||
registerServlet(ourWebContainer, servlet);
|
registerServlet(ourWebContainer, finalProperties);
|
||||||
log.debugv("Servlet with alias " + getAlias() + " registered to secured web container");
|
log.debugv("Servlet with alias " + getAlias() + " registered to secured web container");
|
||||||
return ourWebContainer;
|
return ourWebContainer;
|
||||||
}
|
}
|
||||||
@@ -122,28 +126,82 @@ public class ServletReregistrationService {
|
|||||||
|
|
||||||
// Re-register servlet back to original context
|
// Re-register servlet back to original context
|
||||||
WebContainer externalWebContainer = findExternalWebContainer();
|
WebContainer externalWebContainer = findExternalWebContainer();
|
||||||
Servlet servlet = (Servlet) bundleContext.getService(servletReference);
|
registerServlet(externalWebContainer, obtainProperties());
|
||||||
registerServlet(externalWebContainer, servlet);
|
|
||||||
log.debug("Servlet with alias " + getAlias() + " registered back to external web container");
|
log.debug("Servlet with alias " + getAlias() + " registered back to external web container");
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getAlias() {
|
private String getAlias() {
|
||||||
return (String) servletReference.getProperty("alias");
|
return alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void registerServlet(WebContainer webContainer, Servlet servlet) {
|
/**
|
||||||
|
* Code comes from org.apache.cxf.transport.http.osgi.ServletExporter#updated(java.util.Dictionary)
|
||||||
|
* @param webContainer
|
||||||
|
* @param properties
|
||||||
|
*/
|
||||||
|
protected void registerServlet(WebContainer webContainer, Dictionary properties) {
|
||||||
|
HttpContext httpContext = webContainer.createDefaultHttpContext();
|
||||||
|
|
||||||
|
ServiceReference destinationServiceServiceReference = bundleContext.getServiceReference("org.apache.cxf.transport.http.DestinationRegistry");
|
||||||
|
DestinationRegistry destinationRegistry = (DestinationRegistry) bundleContext.getService(destinationServiceServiceReference);
|
||||||
|
|
||||||
|
Servlet servlet = new CXFNonSpringServlet(destinationRegistry, false);
|
||||||
try {
|
try {
|
||||||
|
if (properties == null) {
|
||||||
|
properties = new Properties();
|
||||||
|
}
|
||||||
|
Properties sprops = new Properties();
|
||||||
|
sprops.put("init-prefix",
|
||||||
|
getProp(properties, CXF_SERVLET_PREFIX + "init-prefix", ""));
|
||||||
|
sprops.put("servlet-name",
|
||||||
|
getProp(properties, CXF_SERVLET_PREFIX + "name", "cxf-osgi-transport-servlet"));
|
||||||
|
sprops.put("hide-service-list-page",
|
||||||
|
getProp(properties, CXF_SERVLET_PREFIX + "hide-service-list-page", "false"));
|
||||||
|
sprops.put("disable-address-updates",
|
||||||
|
getProp(properties, CXF_SERVLET_PREFIX + "disable-address-updates", "true"));
|
||||||
|
sprops.put("base-address",
|
||||||
|
getProp(properties, CXF_SERVLET_PREFIX + "base-address", ""));
|
||||||
|
sprops.put("service-list-path",
|
||||||
|
getProp(properties, CXF_SERVLET_PREFIX + "service-list-path", ""));
|
||||||
|
sprops.put("static-resources-list",
|
||||||
|
getProp(properties, CXF_SERVLET_PREFIX + "static-resources-list", ""));
|
||||||
|
sprops.put("redirects-list",
|
||||||
|
getProp(properties, CXF_SERVLET_PREFIX + "redirects-list", ""));
|
||||||
|
sprops.put("redirect-servlet-name",
|
||||||
|
getProp(properties, CXF_SERVLET_PREFIX + "redirect-servlet-name", ""));
|
||||||
|
sprops.put("redirect-servlet-path",
|
||||||
|
getProp(properties, CXF_SERVLET_PREFIX + "redirect-servlet-path", ""));
|
||||||
|
sprops.put("service-list-all-contexts",
|
||||||
|
getProp(properties, CXF_SERVLET_PREFIX + "service-list-all-contexts", ""));
|
||||||
|
sprops.put("service-list-page-authenticate",
|
||||||
|
getProp(properties, CXF_SERVLET_PREFIX + "service-list-page-authenticate", "false"));
|
||||||
|
sprops.put("service-list-page-authenticate-realm",
|
||||||
|
getProp(properties, CXF_SERVLET_PREFIX + "service-list-page-authenticate-realm", "karaf"));
|
||||||
|
sprops.put("use-x-forwarded-headers",
|
||||||
|
getProp(properties, CXF_SERVLET_PREFIX + "use-x-forwarded-headers", "false"));
|
||||||
|
|
||||||
|
// Accept extra properties by default, can be disabled if it is really needed
|
||||||
|
if (Boolean.valueOf(getProp(properties, CXF_SERVLET_PREFIX + "support.extra.properties", "true").toString())) {
|
||||||
|
Enumeration keys = properties.keys();
|
||||||
|
while (keys.hasMoreElements()) {
|
||||||
|
String nextKey = keys.nextElement().toString();
|
||||||
|
if (!nextKey.startsWith(CXF_SERVLET_PREFIX)) {
|
||||||
|
sprops.put(nextKey, properties.get(nextKey));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Hashtable<String, Object> servletInitParams = new Hashtable<String, Object>();
|
Hashtable<String, Object> servletInitParams = new Hashtable<String, Object>();
|
||||||
String[] propNames = servletReference.getPropertyKeys();
|
Enumeration keys = sprops.keys();
|
||||||
for (String propName : propNames) {
|
|
||||||
|
while(keys.hasMoreElements()){
|
||||||
|
String propName = (String) keys.nextElement();
|
||||||
if (!FILTERED_PROPERTIES.contains(propName)) {
|
if (!FILTERED_PROPERTIES.contains(propName)) {
|
||||||
servletInitParams.put(propName, servletReference.getProperty(propName));
|
servletInitParams.put(propName, sprops.getProperty(propName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to register servlet in given web container now
|
// Try to register servlet in given web container now
|
||||||
HttpContext httpContext = webContainer.createDefaultHttpContext();
|
|
||||||
String alias = (String) servletReference.getProperty("alias");
|
|
||||||
webContainer.registerServlet(alias, servlet, servletInitParams, httpContext);
|
webContainer.registerServlet(alias, servlet, servletInitParams, httpContext);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Can't register servlet in web container", e);
|
log.error("Can't register servlet in web container", e);
|
||||||
@@ -156,7 +214,7 @@ public class ServletReregistrationService {
|
|||||||
* @return web container or null
|
* @return web container or null
|
||||||
*/
|
*/
|
||||||
protected WebContainer findExternalWebContainer() {
|
protected WebContainer findExternalWebContainer() {
|
||||||
BundleContext servletBundleContext = servletReference.getBundle().getBundleContext();
|
BundleContext servletBundleContext = managedServiceReference.getBundle().getBundleContext();
|
||||||
ServiceReference webContainerReference = servletBundleContext.getServiceReference(WebContainer.class.getName());
|
ServiceReference webContainerReference = servletBundleContext.getServiceReference(WebContainer.class.getName());
|
||||||
if (webContainerReference == null) {
|
if (webContainerReference == null) {
|
||||||
log.warn("Not found webContainer reference for bundle " + servletBundleContext);
|
log.warn("Not found webContainer reference for bundle " + servletBundleContext);
|
||||||
@@ -166,4 +224,32 @@ public class ServletReregistrationService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Dictionary obtainProperties(){
|
||||||
|
Dictionary properties = null;
|
||||||
|
ServiceReference reference = bundleContext.getServiceReference(ConfigurationAdmin.class.getName());
|
||||||
|
ConfigurationAdmin admin = (ConfigurationAdmin) bundleContext.getService(reference);
|
||||||
|
try {
|
||||||
|
Configuration configuration = admin.getConfiguration("org.apache.cxf.osgi");
|
||||||
|
properties = configuration.getProperties();
|
||||||
|
} catch (Exception e){
|
||||||
|
log.warn("Unable to obtain cxf osgi configadmin reference.", e);
|
||||||
|
}
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Object getProp(Dictionary properties, String key, Object defaultValue) {
|
||||||
|
Object value = null;
|
||||||
|
if(properties != null){
|
||||||
|
value = properties.get(key);
|
||||||
|
}
|
||||||
|
return value == null ? defaultValue : value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServiceReference getManagedServiceReference() {
|
||||||
|
return managedServiceReference;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setManagedServiceReference(ServiceReference managedServiceReference) {
|
||||||
|
this.managedServiceReference = managedServiceReference;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<name>Keycloak OIDC Client Adapter Modules</name>
|
<name>Keycloak OIDC Client Adapter Modules</name>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
+11
-5
@@ -19,12 +19,12 @@ package org.keycloak.adapters.servlet;
|
|||||||
|
|
||||||
import org.keycloak.KeycloakSecurityContext;
|
import org.keycloak.KeycloakSecurityContext;
|
||||||
import org.keycloak.adapters.AdapterTokenStore;
|
import org.keycloak.adapters.AdapterTokenStore;
|
||||||
import org.keycloak.adapters.spi.HttpFacade;
|
|
||||||
import org.keycloak.adapters.spi.KeycloakAccount;
|
|
||||||
import org.keycloak.adapters.KeycloakDeployment;
|
import org.keycloak.adapters.KeycloakDeployment;
|
||||||
import org.keycloak.adapters.OidcKeycloakAccount;
|
import org.keycloak.adapters.OidcKeycloakAccount;
|
||||||
import org.keycloak.adapters.RefreshableKeycloakSecurityContext;
|
import org.keycloak.adapters.RefreshableKeycloakSecurityContext;
|
||||||
import org.keycloak.adapters.RequestAuthenticator;
|
import org.keycloak.adapters.RequestAuthenticator;
|
||||||
|
import org.keycloak.adapters.spi.HttpFacade;
|
||||||
|
import org.keycloak.adapters.spi.KeycloakAccount;
|
||||||
import org.keycloak.adapters.spi.SessionIdMapper;
|
import org.keycloak.adapters.spi.SessionIdMapper;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@@ -51,10 +51,16 @@ public class OIDCFilterSessionStore extends FilterSessionStore implements Adapte
|
|||||||
}
|
}
|
||||||
|
|
||||||
public HttpServletRequestWrapper buildWrapper() {
|
public HttpServletRequestWrapper buildWrapper() {
|
||||||
HttpSession session = request.getSession();
|
HttpSession session = request.getSession(false);
|
||||||
KeycloakAccount account = (KeycloakAccount)session.getAttribute(KeycloakAccount.class.getName());
|
KeycloakAccount account = null;
|
||||||
|
if (session != null) {
|
||||||
|
account = (KeycloakAccount) session.getAttribute(KeycloakAccount.class.getName());
|
||||||
|
if (account == null) {
|
||||||
|
account = (KeycloakAccount) request.getAttribute(KeycloakAccount.class.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
if (account == null) {
|
if (account == null) {
|
||||||
account = (KeycloakAccount)request.getAttribute(KeycloakAccount.class.getName());
|
account = (KeycloakAccount) request.getAttribute(KeycloakAccount.class.getName());
|
||||||
}
|
}
|
||||||
return buildWrapper(session, account);
|
return buildWrapper(session, account);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@ public class ServletOAuthClientBuilderTest {
|
|||||||
public void testBuilder() {
|
public void testBuilder() {
|
||||||
ServletOAuthClient oauthClient = ServletOAuthClientBuilder.build(getClass().getResourceAsStream("/keycloak.json"));
|
ServletOAuthClient oauthClient = ServletOAuthClientBuilder.build(getClass().getResourceAsStream("/keycloak.json"));
|
||||||
Assert.assertEquals("https://localhost:8443/auth/realms/demo/protocol/openid-connect/auth", oauthClient.getDeployment().getAuthUrl().clone().build().toString());
|
Assert.assertEquals("https://localhost:8443/auth/realms/demo/protocol/openid-connect/auth", oauthClient.getDeployment().getAuthUrl().clone().build().toString());
|
||||||
Assert.assertEquals("https://backend:8443/auth/realms/demo/protocol/openid-connect/token", oauthClient.getDeployment().getTokenUrl());
|
Assert.assertEquals("https://localhost:8443/auth/realms/demo/protocol/openid-connect/token", oauthClient.getDeployment().getTokenUrl());
|
||||||
assertEquals(RelativeUrlsUsed.NEVER, oauthClient.getRelativeUrlsUsed());
|
assertEquals(RelativeUrlsUsed.NEVER, oauthClient.getRelativeUrlsUsed());
|
||||||
Assert.assertEquals("customer-portal", oauthClient.getClientId());
|
Assert.assertEquals("customer-portal", oauthClient.getClientId());
|
||||||
Assert.assertEquals("234234-234234-234234", oauthClient.getCredentials().get(CredentialRepresentation.SECRET));
|
Assert.assertEquals("234234-234234-234234", oauthClient.getCredentials().get(CredentialRepresentation.SECRET));
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
"connection-pool-size": 20,
|
"connection-pool-size": 20,
|
||||||
"disable-trust-manager": true,
|
"disable-trust-manager": true,
|
||||||
"allow-any-hostname": true,
|
"allow-any-hostname": true,
|
||||||
"auth-server-url-for-backend-requests": "https://backend:8443/auth",
|
|
||||||
"always-refresh-token": true,
|
"always-refresh-token": true,
|
||||||
"register-node-at-startup": true,
|
"register-node-at-startup": true,
|
||||||
"register-node-period": 1000,
|
"register-node-period": 1000,
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<name>Keycloak Tomcat Integration</name>
|
<name>Keycloak Tomcat Integration</name>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-tomcat-integration-pom</artifactId>
|
<artifactId>keycloak-tomcat-integration-pom</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-core</artifactId>
|
<artifactId>keycloak-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-adapter-spi</artifactId>
|
<artifactId>keycloak-adapter-spi</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-tomcat-integration-pom</artifactId>
|
<artifactId>keycloak-tomcat-integration-pom</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-core</artifactId>
|
<artifactId>keycloak-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-adapter-core</artifactId>
|
<artifactId>keycloak-adapter-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-tomcat-integration-pom</artifactId>
|
<artifactId>keycloak-tomcat-integration-pom</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-core</artifactId>
|
<artifactId>keycloak-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-adapter-core</artifactId>
|
<artifactId>keycloak-adapter-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-tomcat-integration-pom</artifactId>
|
<artifactId>keycloak-tomcat-integration-pom</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-core</artifactId>
|
<artifactId>keycloak-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-adapter-core</artifactId>
|
<artifactId>keycloak-adapter-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
+2
-2
@@ -17,16 +17,16 @@
|
|||||||
package org.keycloak.adapters.undertow;
|
package org.keycloak.adapters.undertow;
|
||||||
|
|
||||||
import io.undertow.server.HttpServerExchange;
|
import io.undertow.server.HttpServerExchange;
|
||||||
import io.undertow.util.AttachmentKey;
|
|
||||||
import org.keycloak.KeycloakSecurityContext;
|
import org.keycloak.KeycloakSecurityContext;
|
||||||
import org.keycloak.adapters.OIDCHttpFacade;
|
import org.keycloak.adapters.OIDCHttpFacade;
|
||||||
|
|
||||||
|
import static org.keycloak.adapters.undertow.OIDCUndertowHttpFacade.KEYCLOAK_SECURITY_CONTEXT_KEY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||||
* @version $Revision: 1 $
|
* @version $Revision: 1 $
|
||||||
*/
|
*/
|
||||||
public class OIDCServletUndertowHttpFacade extends ServletHttpFacade implements OIDCHttpFacade {
|
public class OIDCServletUndertowHttpFacade extends ServletHttpFacade implements OIDCHttpFacade {
|
||||||
public static final AttachmentKey<KeycloakSecurityContext> KEYCLOAK_SECURITY_CONTEXT_KEY = AttachmentKey.create(KeycloakSecurityContext.class);
|
|
||||||
|
|
||||||
public OIDCServletUndertowHttpFacade(HttpServerExchange exchange) {
|
public OIDCServletUndertowHttpFacade(HttpServerExchange exchange) {
|
||||||
super(exchange);
|
super(exchange);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<name>Keycloak WildFly Integration</name>
|
<name>Keycloak WildFly Integration</name>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-core</artifactId>
|
<artifactId>keycloak-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-adapter-spi</artifactId>
|
<artifactId>keycloak-adapter-spi</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<name>Keycloak Integration</name>
|
<name>Keycloak Integration</name>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-saml-eap-integration-pom</artifactId>
|
<artifactId>keycloak-saml-eap-integration-pom</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@@ -43,6 +43,10 @@
|
|||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-adapter-spi</artifactId>
|
<artifactId>keycloak-adapter-spi</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<artifactId>keycloak-saml-adapter-api-public</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-saml-adapter-core</artifactId>
|
<artifactId>keycloak-saml-adapter-core</artifactId>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<name>Keycloak SAML EAP Integration</name>
|
<name>Keycloak SAML EAP Integration</name>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-saml-eap-integration-pom</artifactId>
|
<artifactId>keycloak-saml-eap-integration-pom</artifactId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|||||||
+2
@@ -45,6 +45,7 @@ public class Constants {
|
|||||||
static final String KEY_STORE = "KeyStore";
|
static final String KEY_STORE = "KeyStore";
|
||||||
static final String SIGN_REQUEST = "signRequest";
|
static final String SIGN_REQUEST = "signRequest";
|
||||||
static final String VALIDATE_RESPONSE_SIGNATURE = "validateResponseSignature";
|
static final String VALIDATE_RESPONSE_SIGNATURE = "validateResponseSignature";
|
||||||
|
static final String VALIDATE_ASSERTION_SIGNATURE = "validateAssertionSignature";
|
||||||
static final String REQUEST_BINDING = "requestBinding";
|
static final String REQUEST_BINDING = "requestBinding";
|
||||||
static final String BINDING_URL = "bindingUrl";
|
static final String BINDING_URL = "bindingUrl";
|
||||||
static final String VALIDATE_REQUEST_SIGNATURE = "validateRequestSignature";
|
static final String VALIDATE_REQUEST_SIGNATURE = "validateRequestSignature";
|
||||||
@@ -97,6 +98,7 @@ public class Constants {
|
|||||||
static final String CERTIFICATE_ALIAS = "alias";
|
static final String CERTIFICATE_ALIAS = "alias";
|
||||||
static final String SIGN_REQUEST = "signRequest";
|
static final String SIGN_REQUEST = "signRequest";
|
||||||
static final String VALIDATE_RESPONSE_SIGNATURE = "validateResponseSignature";
|
static final String VALIDATE_RESPONSE_SIGNATURE = "validateResponseSignature";
|
||||||
|
static final String VALIDATE_ASSERTION_SIGNATURE = "validateAssertionSignature";
|
||||||
static final String REQUEST_BINDING = "requestBinding";
|
static final String REQUEST_BINDING = "requestBinding";
|
||||||
static final String BINDING_URL = "bindingUrl";
|
static final String BINDING_URL = "bindingUrl";
|
||||||
static final String VALIDATE_REQUEST_SIGNATURE = "validateRequestSignature";
|
static final String VALIDATE_REQUEST_SIGNATURE = "validateRequestSignature";
|
||||||
|
|||||||
+2
@@ -39,6 +39,7 @@ public abstract class KeycloakDependencyProcessor implements DeploymentUnitProce
|
|||||||
|
|
||||||
private static final ModuleIdentifier KEYCLOAK_JBOSS_CORE_ADAPTER = ModuleIdentifier.create("org.keycloak.keycloak-jboss-adapter-core");
|
private static final ModuleIdentifier KEYCLOAK_JBOSS_CORE_ADAPTER = ModuleIdentifier.create("org.keycloak.keycloak-jboss-adapter-core");
|
||||||
private static final ModuleIdentifier KEYCLOAK_CORE_ADAPTER = ModuleIdentifier.create("org.keycloak.keycloak-saml-adapter-core");
|
private static final ModuleIdentifier KEYCLOAK_CORE_ADAPTER = ModuleIdentifier.create("org.keycloak.keycloak-saml-adapter-core");
|
||||||
|
private static final ModuleIdentifier KEYCLOAK_API_ADAPTER = ModuleIdentifier.create("org.keycloak.keycloak-saml-adapter-api-public");
|
||||||
private static final ModuleIdentifier KEYCLOAK_COMMON = ModuleIdentifier.create("org.keycloak.keycloak-common");
|
private static final ModuleIdentifier KEYCLOAK_COMMON = ModuleIdentifier.create("org.keycloak.keycloak-common");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -71,6 +72,7 @@ public abstract class KeycloakDependencyProcessor implements DeploymentUnitProce
|
|||||||
// ModuleDependency(ModuleLoader moduleLoader, ModuleIdentifier identifier, boolean optional, boolean export, boolean importServices, boolean userSpecified)
|
// ModuleDependency(ModuleLoader moduleLoader, ModuleIdentifier identifier, boolean optional, boolean export, boolean importServices, boolean userSpecified)
|
||||||
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_JBOSS_CORE_ADAPTER, false, false, false, false));
|
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_JBOSS_CORE_ADAPTER, false, false, false, false));
|
||||||
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_CORE_ADAPTER, false, false, false, false));
|
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_CORE_ADAPTER, false, false, false, false));
|
||||||
|
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_API_ADAPTER, false, false, false, false));
|
||||||
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_COMMON, false, false, false, false));
|
moduleSpecification.addSystemDependency(new ModuleDependency(moduleLoader, KEYCLOAK_COMMON, false, false, false, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-1
@@ -37,6 +37,11 @@ abstract class SingleSignOnDefinition {
|
|||||||
.setXmlName(Constants.XML.VALIDATE_RESPONSE_SIGNATURE)
|
.setXmlName(Constants.XML.VALIDATE_RESPONSE_SIGNATURE)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
static final SimpleAttributeDefinition VALIDATE_ASSERTION_SIGNATURE =
|
||||||
|
new SimpleAttributeDefinitionBuilder(Constants.Model.VALIDATE_ASSERTION_SIGNATURE, ModelType.BOOLEAN, true)
|
||||||
|
.setXmlName(Constants.XML.VALIDATE_ASSERTION_SIGNATURE)
|
||||||
|
.build();
|
||||||
|
|
||||||
static final SimpleAttributeDefinition REQUEST_BINDING =
|
static final SimpleAttributeDefinition REQUEST_BINDING =
|
||||||
new SimpleAttributeDefinitionBuilder(Constants.Model.REQUEST_BINDING, ModelType.STRING, true)
|
new SimpleAttributeDefinitionBuilder(Constants.Model.REQUEST_BINDING, ModelType.STRING, true)
|
||||||
.setXmlName(Constants.XML.REQUEST_BINDING)
|
.setXmlName(Constants.XML.REQUEST_BINDING)
|
||||||
@@ -52,7 +57,7 @@ abstract class SingleSignOnDefinition {
|
|||||||
.setXmlName(Constants.XML.BINDING_URL)
|
.setXmlName(Constants.XML.BINDING_URL)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
static final SimpleAttributeDefinition[] ATTRIBUTES = {SIGN_REQUEST, VALIDATE_RESPONSE_SIGNATURE, REQUEST_BINDING, RESPONSE_BINDING, BINDING_URL};
|
static final SimpleAttributeDefinition[] ATTRIBUTES = {SIGN_REQUEST, VALIDATE_RESPONSE_SIGNATURE, VALIDATE_ASSERTION_SIGNATURE, REQUEST_BINDING, RESPONSE_BINDING, BINDING_URL};
|
||||||
|
|
||||||
static final HashMap<String, SimpleAttributeDefinition> ATTRIBUTE_MAP = new HashMap<>();
|
static final HashMap<String, SimpleAttributeDefinition> ATTRIBUTE_MAP = new HashMap<>();
|
||||||
|
|
||||||
|
|||||||
+1
@@ -67,6 +67,7 @@ keycloak-saml.IDP.signatureCanonicalizationMethod=Signature canonicalization met
|
|||||||
keycloak-saml.IDP.SingleSignOnService=Single sign-on configuration
|
keycloak-saml.IDP.SingleSignOnService=Single sign-on configuration
|
||||||
keycloak-saml.IDP.SingleSignOnService.signRequest=Sign SSO requests
|
keycloak-saml.IDP.SingleSignOnService.signRequest=Sign SSO requests
|
||||||
keycloak-saml.IDP.SingleSignOnService.validateResponseSignature=Validate an SSO response signature
|
keycloak-saml.IDP.SingleSignOnService.validateResponseSignature=Validate an SSO response signature
|
||||||
|
keycloak-saml.IDP.SingleSignOnService.validateAssertionSignature=Validate an SSO assertion signature
|
||||||
keycloak-saml.IDP.SingleSignOnService.requestBinding=HTTP method to use for requests
|
keycloak-saml.IDP.SingleSignOnService.requestBinding=HTTP method to use for requests
|
||||||
keycloak-saml.IDP.SingleSignOnService.responseBinding=HTTP method to use for responses
|
keycloak-saml.IDP.SingleSignOnService.responseBinding=HTTP method to use for responses
|
||||||
keycloak-saml.IDP.SingleSignOnService.bindingUrl=SSO endpoint URL
|
keycloak-saml.IDP.SingleSignOnService.bindingUrl=SSO endpoint URL
|
||||||
|
|||||||
+5
@@ -132,6 +132,11 @@
|
|||||||
<xs:documentation>Validate the SSO response signature</xs:documentation>
|
<xs:documentation>Validate the SSO response signature</xs:documentation>
|
||||||
</xs:annotation>
|
</xs:annotation>
|
||||||
</xs:attribute>
|
</xs:attribute>
|
||||||
|
<xs:attribute name="validateAssertionSignature" type="xs:boolean" use="optional">
|
||||||
|
<xs:annotation>
|
||||||
|
<xs:documentation>Validate the SSO assertion signature</xs:documentation>
|
||||||
|
</xs:annotation>
|
||||||
|
</xs:attribute>
|
||||||
<xs:attribute name="requestBinding" type="xs:string" use="optional">
|
<xs:attribute name="requestBinding" type="xs:string" use="optional">
|
||||||
<xs:annotation>
|
<xs:annotation>
|
||||||
<xs:documentation>HTTP method to use for requests</xs:documentation>
|
<xs:documentation>HTTP method to use for requests</xs:documentation>
|
||||||
|
|||||||
+1
@@ -42,6 +42,7 @@
|
|||||||
<IDP entityID="idp">
|
<IDP entityID="idp">
|
||||||
<SingleSignOnService signRequest="true"
|
<SingleSignOnService signRequest="true"
|
||||||
validateResponseSignature="true"
|
validateResponseSignature="true"
|
||||||
|
validateAssertionSignature="true"
|
||||||
requestBinding="POST"
|
requestBinding="POST"
|
||||||
bindingUrl="http://localhost:8080/auth/realms/saml-demo/protocol/saml"/>
|
bindingUrl="http://localhost:8080/auth/realms/saml-demo/protocol/saml"/>
|
||||||
<SingleLogoutService
|
<SingleLogoutService
|
||||||
|
|||||||
Executable
+83
@@ -0,0 +1,83 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||||
|
~ and other contributors as indicated by the @author tags.
|
||||||
|
~
|
||||||
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
~ you may not use this file except in compliance with the License.
|
||||||
|
~ You may obtain a copy of the License at
|
||||||
|
~
|
||||||
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
~
|
||||||
|
~ Unless required by applicable law or agreed to in writing, software
|
||||||
|
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
~ See the License for the specific language governing permissions and
|
||||||
|
~ limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>keycloak-parent</artifactId>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<version>2.0.0.Test2</version>
|
||||||
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>keycloak-saml-adapter-api-public</artifactId>
|
||||||
|
<name>Keycloak SAML Client Adapter Public API</name>
|
||||||
|
<description/>
|
||||||
|
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<timestamp>${maven.build.timestamp}</timestamp>
|
||||||
|
<maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<artifactId>keycloak-saml-core-public</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<artifactId>keycloak-saml-core</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<artifactId>keycloak-adapter-spi</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<artifactId>keycloak-common</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jboss.logging</groupId>
|
||||||
|
<artifactId>jboss-logging</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<source>${maven.compiler.source}</source>
|
||||||
|
<target>${maven.compiler.target}</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
-1
@@ -19,7 +19,6 @@ package org.keycloak.adapters.saml;
|
|||||||
|
|
||||||
import org.keycloak.adapters.spi.AuthenticationError;
|
import org.keycloak.adapters.spi.AuthenticationError;
|
||||||
import org.keycloak.dom.saml.v2.protocol.StatusResponseType;
|
import org.keycloak.dom.saml.v2.protocol.StatusResponseType;
|
||||||
import org.keycloak.dom.saml.v2.protocol.StatusType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object that describes the SAML error that happened.
|
* Object that describes the SAML error that happened.
|
||||||
File renamed without changes.
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@@ -35,6 +35,11 @@
|
|||||||
<maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format>
|
<maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<artifactId>keycloak-saml-core-public</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-saml-core</artifactId>
|
<artifactId>keycloak-saml-core</artifactId>
|
||||||
@@ -45,7 +50,12 @@
|
|||||||
<artifactId>keycloak-adapter-spi</artifactId>
|
<artifactId>keycloak-adapter-spi</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<artifactId>keycloak-saml-adapter-api-public</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-common</artifactId>
|
<artifactId>keycloak-common</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
|
|||||||
+49
-40
@@ -26,7 +26,6 @@ import org.keycloak.saml.SAML2NameIDPolicyBuilder;
|
|||||||
import org.keycloak.saml.common.constants.JBossSAMLURIConstants;
|
import org.keycloak.saml.common.constants.JBossSAMLURIConstants;
|
||||||
import org.keycloak.saml.common.exceptions.ConfigurationException;
|
import org.keycloak.saml.common.exceptions.ConfigurationException;
|
||||||
import org.keycloak.saml.common.exceptions.ProcessingException;
|
import org.keycloak.saml.common.exceptions.ProcessingException;
|
||||||
import org.w3c.dom.Document;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.security.KeyPair;
|
import java.security.KeyPair;
|
||||||
@@ -54,45 +53,8 @@ public abstract class AbstractInitiateLogin implements AuthChallenge {
|
|||||||
@Override
|
@Override
|
||||||
public boolean challenge(HttpFacade httpFacade) {
|
public boolean challenge(HttpFacade httpFacade) {
|
||||||
try {
|
try {
|
||||||
String issuerURL = deployment.getEntityID();
|
SAML2AuthnRequestBuilder authnRequestBuilder = buildSaml2AuthnRequestBuilder(deployment);
|
||||||
String nameIDPolicyFormat = deployment.getNameIDPolicyFormat();
|
BaseSAML2BindingBuilder binding = createSaml2Binding(deployment);
|
||||||
|
|
||||||
if (nameIDPolicyFormat == null) {
|
|
||||||
nameIDPolicyFormat = JBossSAMLURIConstants.NAMEID_FORMAT_PERSISTENT.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
SAML2AuthnRequestBuilder authnRequestBuilder = new SAML2AuthnRequestBuilder()
|
|
||||||
.destination(deployment.getIDP().getSingleSignOnService().getRequestBindingUrl())
|
|
||||||
.issuer(issuerURL)
|
|
||||||
.forceAuthn(deployment.isForceAuthentication()).isPassive(deployment.isIsPassive())
|
|
||||||
.nameIdPolicy(SAML2NameIDPolicyBuilder.format(nameIDPolicyFormat));
|
|
||||||
if (deployment.getIDP().getSingleSignOnService().getResponseBinding() != null) {
|
|
||||||
String protocolBinding = JBossSAMLURIConstants.SAML_HTTP_REDIRECT_BINDING.get();
|
|
||||||
if (deployment.getIDP().getSingleSignOnService().getResponseBinding() == SamlDeployment.Binding.POST) {
|
|
||||||
protocolBinding = JBossSAMLURIConstants.SAML_HTTP_POST_BINDING.get();
|
|
||||||
}
|
|
||||||
authnRequestBuilder.protocolBinding(protocolBinding);
|
|
||||||
|
|
||||||
}
|
|
||||||
if (deployment.getAssertionConsumerServiceUrl() != null) {
|
|
||||||
authnRequestBuilder.assertionConsumerUrl(deployment.getAssertionConsumerServiceUrl());
|
|
||||||
}
|
|
||||||
BaseSAML2BindingBuilder binding = new BaseSAML2BindingBuilder();
|
|
||||||
|
|
||||||
if (deployment.getIDP().getSingleSignOnService().signRequest()) {
|
|
||||||
|
|
||||||
|
|
||||||
KeyPair keypair = deployment.getSigningKeyPair();
|
|
||||||
if (keypair == null) {
|
|
||||||
throw new RuntimeException("Signing keys not configured");
|
|
||||||
}
|
|
||||||
if (deployment.getSignatureCanonicalizationMethod() != null) {
|
|
||||||
binding.canonicalizationMethod(deployment.getSignatureCanonicalizationMethod());
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.signWith(keypair);
|
|
||||||
binding.signDocument();
|
|
||||||
}
|
|
||||||
sessionStore.saveRequest();
|
sessionStore.saveRequest();
|
||||||
|
|
||||||
sendAuthnRequest(httpFacade, authnRequestBuilder, binding);
|
sendAuthnRequest(httpFacade, authnRequestBuilder, binding);
|
||||||
@@ -103,6 +65,53 @@ public abstract class AbstractInitiateLogin implements AuthChallenge {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static BaseSAML2BindingBuilder createSaml2Binding(SamlDeployment deployment) {
|
||||||
|
BaseSAML2BindingBuilder binding = new BaseSAML2BindingBuilder();
|
||||||
|
|
||||||
|
if (deployment.getIDP().getSingleSignOnService().signRequest()) {
|
||||||
|
|
||||||
|
binding.signatureAlgorithm(deployment.getSignatureAlgorithm());
|
||||||
|
KeyPair keypair = deployment.getSigningKeyPair();
|
||||||
|
if (keypair == null) {
|
||||||
|
throw new RuntimeException("Signing keys not configured");
|
||||||
|
}
|
||||||
|
if (deployment.getSignatureCanonicalizationMethod() != null) {
|
||||||
|
binding.canonicalizationMethod(deployment.getSignatureCanonicalizationMethod());
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.signWith(keypair);
|
||||||
|
binding.signDocument();
|
||||||
|
}
|
||||||
|
return binding;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SAML2AuthnRequestBuilder buildSaml2AuthnRequestBuilder(SamlDeployment deployment) {
|
||||||
|
String issuerURL = deployment.getEntityID();
|
||||||
|
String nameIDPolicyFormat = deployment.getNameIDPolicyFormat();
|
||||||
|
|
||||||
|
if (nameIDPolicyFormat == null) {
|
||||||
|
nameIDPolicyFormat = JBossSAMLURIConstants.NAMEID_FORMAT_PERSISTENT.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
SAML2AuthnRequestBuilder authnRequestBuilder = new SAML2AuthnRequestBuilder()
|
||||||
|
.destination(deployment.getIDP().getSingleSignOnService().getRequestBindingUrl())
|
||||||
|
.issuer(issuerURL)
|
||||||
|
.forceAuthn(deployment.isForceAuthentication()).isPassive(deployment.isIsPassive())
|
||||||
|
.nameIdPolicy(SAML2NameIDPolicyBuilder.format(nameIDPolicyFormat));
|
||||||
|
if (deployment.getIDP().getSingleSignOnService().getResponseBinding() != null) {
|
||||||
|
String protocolBinding = JBossSAMLURIConstants.SAML_HTTP_REDIRECT_BINDING.get();
|
||||||
|
if (deployment.getIDP().getSingleSignOnService().getResponseBinding() == SamlDeployment.Binding.POST) {
|
||||||
|
protocolBinding = JBossSAMLURIConstants.SAML_HTTP_POST_BINDING.get();
|
||||||
|
}
|
||||||
|
authnRequestBuilder.protocolBinding(protocolBinding);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (deployment.getAssertionConsumerServiceUrl() != null) {
|
||||||
|
authnRequestBuilder.assertionConsumerUrl(deployment.getAssertionConsumerServiceUrl());
|
||||||
|
}
|
||||||
|
return authnRequestBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract void sendAuthnRequest(HttpFacade httpFacade, SAML2AuthnRequestBuilder authnRequestBuilder, BaseSAML2BindingBuilder binding) throws ProcessingException, ConfigurationException, IOException;
|
protected abstract void sendAuthnRequest(HttpFacade httpFacade, SAML2AuthnRequestBuilder authnRequestBuilder, BaseSAML2BindingBuilder binding) throws ProcessingException, ConfigurationException, IOException;
|
||||||
|
|
||||||
}
|
}
|
||||||
+10
@@ -34,6 +34,7 @@ public class DefaultSamlDeployment implements SamlDeployment {
|
|||||||
public static class DefaultSingleSignOnService implements IDP.SingleSignOnService {
|
public static class DefaultSingleSignOnService implements IDP.SingleSignOnService {
|
||||||
private boolean signRequest;
|
private boolean signRequest;
|
||||||
private boolean validateResponseSignature;
|
private boolean validateResponseSignature;
|
||||||
|
private boolean validateAssertionSignature;
|
||||||
private Binding requestBinding;
|
private Binding requestBinding;
|
||||||
private Binding responseBinding;
|
private Binding responseBinding;
|
||||||
private String requestBindingUrl;
|
private String requestBindingUrl;
|
||||||
@@ -48,6 +49,11 @@ public class DefaultSamlDeployment implements SamlDeployment {
|
|||||||
return validateResponseSignature;
|
return validateResponseSignature;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean validateAssertionSignature() {
|
||||||
|
return validateAssertionSignature;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Binding getRequestBinding() {
|
public Binding getRequestBinding() {
|
||||||
return requestBinding;
|
return requestBinding;
|
||||||
@@ -71,6 +77,10 @@ public class DefaultSamlDeployment implements SamlDeployment {
|
|||||||
this.validateResponseSignature = validateResponseSignature;
|
this.validateResponseSignature = validateResponseSignature;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setValidateAssertionSignature(boolean validateAssertionSignature) {
|
||||||
|
this.validateAssertionSignature = validateAssertionSignature;
|
||||||
|
}
|
||||||
|
|
||||||
public void setRequestBinding(Binding requestBinding) {
|
public void setRequestBinding(Binding requestBinding) {
|
||||||
this.requestBinding = requestBinding;
|
this.requestBinding = requestBinding;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ public interface SamlDeployment {
|
|||||||
public interface SingleSignOnService {
|
public interface SingleSignOnService {
|
||||||
boolean signRequest();
|
boolean signRequest();
|
||||||
boolean validateResponseSignature();
|
boolean validateResponseSignature();
|
||||||
|
boolean validateAssertionSignature();
|
||||||
Binding getRequestBinding();
|
Binding getRequestBinding();
|
||||||
Binding getResponseBinding();
|
Binding getResponseBinding();
|
||||||
String getRequestBindingUrl();
|
String getRequestBindingUrl();
|
||||||
|
|||||||
@@ -18,8 +18,6 @@
|
|||||||
package org.keycloak.adapters.saml;
|
package org.keycloak.adapters.saml;
|
||||||
|
|
||||||
import org.keycloak.adapters.spi.AdapterSessionStore;
|
import org.keycloak.adapters.spi.AdapterSessionStore;
|
||||||
import org.keycloak.dom.saml.v2.protocol.StatusResponseType;
|
|
||||||
import org.keycloak.dom.saml.v2.protocol.StatusType;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ public class IDP implements Serializable {
|
|||||||
private String requestBinding;
|
private String requestBinding;
|
||||||
private String responseBinding;
|
private String responseBinding;
|
||||||
private String bindingUrl;
|
private String bindingUrl;
|
||||||
|
private boolean validateAssertionSignature;
|
||||||
|
|
||||||
public boolean isSignRequest() {
|
public boolean isSignRequest() {
|
||||||
return signRequest;
|
return signRequest;
|
||||||
@@ -50,6 +51,14 @@ public class IDP implements Serializable {
|
|||||||
this.validateResponseSignature = validateResponseSignature;
|
this.validateResponseSignature = validateResponseSignature;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isValidateAssertionSignature() {
|
||||||
|
return validateAssertionSignature;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValidateAssertionSignature(boolean validateAssertionSignature) {
|
||||||
|
this.validateAssertionSignature = validateAssertionSignature;
|
||||||
|
}
|
||||||
|
|
||||||
public String getRequestBinding() {
|
public String getRequestBinding() {
|
||||||
return requestBinding;
|
return requestBinding;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -68,6 +68,7 @@ public class ConfigXmlConstants {
|
|||||||
public static final String RESPONSE_BINDING_ATTR = "responseBinding";
|
public static final String RESPONSE_BINDING_ATTR = "responseBinding";
|
||||||
public static final String BINDING_URL_ATTR = "bindingUrl";
|
public static final String BINDING_URL_ATTR = "bindingUrl";
|
||||||
public static final String VALIDATE_RESPONSE_SIGNATURE_ATTR = "validateResponseSignature";
|
public static final String VALIDATE_RESPONSE_SIGNATURE_ATTR = "validateResponseSignature";
|
||||||
|
public static final String VALIDATE_ASSERTION_SIGNATURE_ATTR = "validateAssertionSignature";
|
||||||
public static final String VALIDATE_REQUEST_SIGNATURE_ATTR = "validateRequestSignature";
|
public static final String VALIDATE_REQUEST_SIGNATURE_ATTR = "validateRequestSignature";
|
||||||
public static final String POST_BINDING_URL_ATTR = "postBindingUrl";
|
public static final String POST_BINDING_URL_ATTR = "postBindingUrl";
|
||||||
public static final String REDIRECT_BINDING_URL_ATTR = "redirectBindingUrl";
|
public static final String REDIRECT_BINDING_URL_ATTR = "redirectBindingUrl";
|
||||||
|
|||||||
+1
@@ -149,6 +149,7 @@ public class DeploymentBuilder {
|
|||||||
}
|
}
|
||||||
sso.setSignRequest(sp.getIdp().getSingleSignOnService().isSignRequest());
|
sso.setSignRequest(sp.getIdp().getSingleSignOnService().isSignRequest());
|
||||||
sso.setValidateResponseSignature(sp.getIdp().getSingleSignOnService().isValidateResponseSignature());
|
sso.setValidateResponseSignature(sp.getIdp().getSingleSignOnService().isValidateResponseSignature());
|
||||||
|
sso.setValidateAssertionSignature(sp.getIdp().getSingleSignOnService().isValidateAssertionSignature());
|
||||||
|
|
||||||
slo.setSignRequest(sp.getIdp().getSingleLogoutService().isSignRequest());
|
slo.setSignRequest(sp.getIdp().getSingleLogoutService().isSignRequest());
|
||||||
slo.setSignResponse(sp.getIdp().getSingleLogoutService().isSignResponse());
|
slo.setSignResponse(sp.getIdp().getSingleLogoutService().isSignResponse());
|
||||||
|
|||||||
+1
@@ -106,6 +106,7 @@ public class IDPXmlParser extends AbstractParser {
|
|||||||
StartElement element = StaxParserUtil.getNextStartElement(xmlEventReader);
|
StartElement element = StaxParserUtil.getNextStartElement(xmlEventReader);
|
||||||
sso.setSignRequest(SPXmlParser.getBooleanAttributeValue(element, ConfigXmlConstants.SIGN_REQUEST_ATTR, signaturesRequired));
|
sso.setSignRequest(SPXmlParser.getBooleanAttributeValue(element, ConfigXmlConstants.SIGN_REQUEST_ATTR, signaturesRequired));
|
||||||
sso.setValidateResponseSignature(SPXmlParser.getBooleanAttributeValue(element, ConfigXmlConstants.VALIDATE_RESPONSE_SIGNATURE_ATTR, signaturesRequired));
|
sso.setValidateResponseSignature(SPXmlParser.getBooleanAttributeValue(element, ConfigXmlConstants.VALIDATE_RESPONSE_SIGNATURE_ATTR, signaturesRequired));
|
||||||
|
sso.setValidateAssertionSignature(SPXmlParser.getBooleanAttributeValue(element, ConfigXmlConstants.VALIDATE_ASSERTION_SIGNATURE_ATTR));
|
||||||
sso.setRequestBinding(SPXmlParser.getAttributeValue(element, ConfigXmlConstants.REQUEST_BINDING_ATTR));
|
sso.setRequestBinding(SPXmlParser.getAttributeValue(element, ConfigXmlConstants.REQUEST_BINDING_ATTR));
|
||||||
sso.setResponseBinding(SPXmlParser.getAttributeValue(element, ConfigXmlConstants.RESPONSE_BINDING_ATTR));
|
sso.setResponseBinding(SPXmlParser.getAttributeValue(element, ConfigXmlConstants.RESPONSE_BINDING_ATTR));
|
||||||
sso.setBindingUrl(SPXmlParser.getAttributeValue(element, ConfigXmlConstants.BINDING_URL_ATTR));
|
sso.setBindingUrl(SPXmlParser.getAttributeValue(element, ConfigXmlConstants.BINDING_URL_ATTR));
|
||||||
|
|||||||
-1
@@ -25,7 +25,6 @@ import org.keycloak.saml.common.util.StaxParserUtil;
|
|||||||
|
|
||||||
import javax.xml.namespace.QName;
|
import javax.xml.namespace.QName;
|
||||||
import javax.xml.stream.XMLEventReader;
|
import javax.xml.stream.XMLEventReader;
|
||||||
import javax.xml.stream.XMLStreamException;
|
|
||||||
import javax.xml.stream.events.StartElement;
|
import javax.xml.stream.events.StartElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
-1
@@ -18,7 +18,6 @@
|
|||||||
package org.keycloak.adapters.saml.config.parsers;
|
package org.keycloak.adapters.saml.config.parsers;
|
||||||
|
|
||||||
import org.keycloak.adapters.saml.config.Key;
|
import org.keycloak.adapters.saml.config.Key;
|
||||||
import org.keycloak.adapters.saml.config.SP;
|
|
||||||
import org.keycloak.saml.common.exceptions.ParsingException;
|
import org.keycloak.saml.common.exceptions.ParsingException;
|
||||||
import org.keycloak.saml.common.parsers.AbstractParser;
|
import org.keycloak.saml.common.parsers.AbstractParser;
|
||||||
import org.keycloak.saml.common.util.StaxParserUtil;
|
import org.keycloak.saml.common.util.StaxParserUtil;
|
||||||
|
|||||||
+28
-3
@@ -201,7 +201,7 @@ public abstract class AbstractSamlAuthenticationHandler implements SamlAuthentic
|
|||||||
return AuthOutcome.FAILED;
|
return AuthOutcome.FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return handleLoginResponse((ResponseType) statusResponse, onCreateSession);
|
return handleLoginResponse((ResponseType) statusResponse, postBinding, onCreateSession);
|
||||||
} finally {
|
} finally {
|
||||||
sessionStore.setCurrentAction(SamlSessionStore.CurrentAction.NONE);
|
sessionStore.setCurrentAction(SamlSessionStore.CurrentAction.NONE);
|
||||||
}
|
}
|
||||||
@@ -272,8 +272,7 @@ public abstract class AbstractSamlAuthenticationHandler implements SamlAuthentic
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AuthOutcome handleLoginResponse(ResponseType responseType, OnSessionCreated onCreateSession) {
|
protected AuthOutcome handleLoginResponse(ResponseType responseType, boolean postBinding, OnSessionCreated onCreateSession) {
|
||||||
|
|
||||||
AssertionType assertion = null;
|
AssertionType assertion = null;
|
||||||
try {
|
try {
|
||||||
assertion = AssertionUtil.getAssertion(responseType, deployment.getDecryptionKey());
|
assertion = AssertionUtil.getAssertion(responseType, deployment.getDecryptionKey());
|
||||||
@@ -298,6 +297,32 @@ public abstract class AbstractSamlAuthenticationHandler implements SamlAuthentic
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (deployment.getIDP().getSingleSignOnService().validateAssertionSignature()) {
|
||||||
|
try {
|
||||||
|
validateSamlSignature(new SAMLDocumentHolder(AssertionUtil.asDocument(assertion)), postBinding, GeneralConstants.SAML_RESPONSE_KEY);
|
||||||
|
} catch (VerificationException e) {
|
||||||
|
log.error("Failed to verify saml assertion signature", e);
|
||||||
|
|
||||||
|
challenge = new AuthChallenge() {
|
||||||
|
@Override
|
||||||
|
public boolean challenge(HttpFacade exchange) {
|
||||||
|
SamlAuthenticationError error = new SamlAuthenticationError(SamlAuthenticationError.Reason.INVALID_SIGNATURE);
|
||||||
|
exchange.getRequest().setError(error);
|
||||||
|
exchange.getResponse().sendError(403);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getResponseCode() {
|
||||||
|
return 403;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return AuthOutcome.FAILED;
|
||||||
|
} catch (ProcessingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SubjectType subject = assertion.getSubject();
|
SubjectType subject = assertion.getSubject();
|
||||||
SubjectType.STSubType subType = subject.getSubType();
|
SubjectType.STSubType subType = subject.getSubType();
|
||||||
NameIDType subjectNameID = (NameIDType) subType.getBaseID();
|
NameIDType subjectNameID = (NameIDType) subType.getBaseID();
|
||||||
|
|||||||
-1
@@ -23,7 +23,6 @@ import org.keycloak.adapters.saml.SamlSessionStore;
|
|||||||
import org.keycloak.adapters.saml.profile.SamlInvocationContext;
|
import org.keycloak.adapters.saml.profile.SamlInvocationContext;
|
||||||
import org.keycloak.adapters.spi.AuthOutcome;
|
import org.keycloak.adapters.spi.AuthOutcome;
|
||||||
import org.keycloak.adapters.spi.HttpFacade;
|
import org.keycloak.adapters.spi.HttpFacade;
|
||||||
import org.keycloak.saml.common.constants.GeneralConstants;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||||
|
|||||||
-1
@@ -20,7 +20,6 @@ package org.keycloak.adapters.saml.profile.webbrowsersso;
|
|||||||
import org.keycloak.adapters.saml.OnSessionCreated;
|
import org.keycloak.adapters.saml.OnSessionCreated;
|
||||||
import org.keycloak.adapters.saml.SamlDeployment;
|
import org.keycloak.adapters.saml.SamlDeployment;
|
||||||
import org.keycloak.adapters.saml.SamlSessionStore;
|
import org.keycloak.adapters.saml.SamlSessionStore;
|
||||||
import org.keycloak.adapters.saml.profile.SamlInvocationContext;
|
|
||||||
import org.keycloak.adapters.spi.AuthOutcome;
|
import org.keycloak.adapters.spi.AuthOutcome;
|
||||||
import org.keycloak.adapters.spi.HttpFacade;
|
import org.keycloak.adapters.spi.HttpFacade;
|
||||||
import org.keycloak.saml.common.constants.GeneralConstants;
|
import org.keycloak.saml.common.constants.GeneralConstants;
|
||||||
|
|||||||
+5
-2
@@ -79,11 +79,11 @@ public class WebBrowserSsoAuthenticationHandler extends AbstractSamlAuthenticati
|
|||||||
builder.issuer(issuerURL);
|
builder.issuer(issuerURL);
|
||||||
BaseSAML2BindingBuilder binding = new BaseSAML2BindingBuilder().relayState(relayState);
|
BaseSAML2BindingBuilder binding = new BaseSAML2BindingBuilder().relayState(relayState);
|
||||||
if (deployment.getIDP().getSingleLogoutService().signResponse()) {
|
if (deployment.getIDP().getSingleLogoutService().signResponse()) {
|
||||||
|
if (deployment.getSignatureCanonicalizationMethod() != null)
|
||||||
|
binding.canonicalizationMethod(deployment.getSignatureCanonicalizationMethod());
|
||||||
binding.signatureAlgorithm(deployment.getSignatureAlgorithm())
|
binding.signatureAlgorithm(deployment.getSignatureAlgorithm())
|
||||||
.signWith(deployment.getSigningKeyPair())
|
.signWith(deployment.getSigningKeyPair())
|
||||||
.signDocument();
|
.signDocument();
|
||||||
if (deployment.getSignatureCanonicalizationMethod() != null)
|
|
||||||
binding.canonicalizationMethod(deployment.getSignatureCanonicalizationMethod());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -110,6 +110,9 @@ public class WebBrowserSsoAuthenticationHandler extends AbstractSamlAuthenticati
|
|||||||
.destination(deployment.getIDP().getSingleLogoutService().getRequestBindingUrl());
|
.destination(deployment.getIDP().getSingleLogoutService().getRequestBindingUrl());
|
||||||
BaseSAML2BindingBuilder binding = new BaseSAML2BindingBuilder();
|
BaseSAML2BindingBuilder binding = new BaseSAML2BindingBuilder();
|
||||||
if (deployment.getIDP().getSingleLogoutService().signRequest()) {
|
if (deployment.getIDP().getSingleLogoutService().signRequest()) {
|
||||||
|
if (deployment.getSignatureCanonicalizationMethod() != null)
|
||||||
|
binding.canonicalizationMethod(deployment.getSignatureCanonicalizationMethod());
|
||||||
|
binding.signatureAlgorithm(deployment.getSignatureAlgorithm());
|
||||||
binding.signWith(deployment.getSigningKeyPair())
|
binding.signWith(deployment.getSigningKeyPair())
|
||||||
.signDocument();
|
.signDocument();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,6 +112,7 @@
|
|||||||
<xs:complexType name="sign-on-type">
|
<xs:complexType name="sign-on-type">
|
||||||
<xs:attribute name="signRequest" type="xs:boolean" use="optional"/>
|
<xs:attribute name="signRequest" type="xs:boolean" use="optional"/>
|
||||||
<xs:attribute name="validateResponseSignature" type="xs:boolean" use="optional"/>
|
<xs:attribute name="validateResponseSignature" type="xs:boolean" use="optional"/>
|
||||||
|
<xs:attribute name="validateAssertionSignature" type="xs:boolean" use="optional"/>
|
||||||
<xs:attribute name="requestBinding" type="xs:string" use="optional"/>
|
<xs:attribute name="requestBinding" type="xs:string" use="optional"/>
|
||||||
<xs:attribute name="responseBinding" type="xs:string" use="optional"/>
|
<xs:attribute name="responseBinding" type="xs:string" use="optional"/>
|
||||||
<xs:attribute name="bindingUrl" type="xs:string" use="optional"/>
|
<xs:attribute name="bindingUrl" type="xs:string" use="optional"/>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@@ -60,6 +60,10 @@
|
|||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-saml-core</artifactId>
|
<artifactId>keycloak-saml-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<artifactId>keycloak-saml-adapter-api-public</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-saml-adapter-core</artifactId>
|
<artifactId>keycloak-saml-adapter-core</artifactId>
|
||||||
|
|||||||
-2
@@ -27,10 +27,8 @@ import org.eclipse.jetty.security.authentication.FormAuthenticator;
|
|||||||
import org.eclipse.jetty.security.authentication.LoginAuthenticator;
|
import org.eclipse.jetty.security.authentication.LoginAuthenticator;
|
||||||
import org.eclipse.jetty.server.Authentication;
|
import org.eclipse.jetty.server.Authentication;
|
||||||
import org.eclipse.jetty.server.Request;
|
import org.eclipse.jetty.server.Request;
|
||||||
import org.eclipse.jetty.server.Response;
|
|
||||||
import org.eclipse.jetty.server.UserIdentity;
|
import org.eclipse.jetty.server.UserIdentity;
|
||||||
import org.eclipse.jetty.server.handler.ContextHandler;
|
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||||
import org.eclipse.jetty.util.URIUtil;
|
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
import org.keycloak.adapters.saml.SamlSessionStore;
|
import org.keycloak.adapters.saml.SamlSessionStore;
|
||||||
import org.keycloak.adapters.saml.profile.SamlAuthenticationHandler;
|
import org.keycloak.adapters.saml.profile.SamlAuthenticationHandler;
|
||||||
|
|||||||
-1
@@ -28,7 +28,6 @@ import org.keycloak.adapters.jetty.spi.JettyUserSessionManagement;
|
|||||||
import org.keycloak.adapters.saml.SamlSession;
|
import org.keycloak.adapters.saml.SamlSession;
|
||||||
import org.keycloak.adapters.saml.SamlSessionStore;
|
import org.keycloak.adapters.saml.SamlSessionStore;
|
||||||
import org.keycloak.common.util.KeycloakUriBuilder;
|
import org.keycloak.common.util.KeycloakUriBuilder;
|
||||||
import org.keycloak.dom.saml.v2.protocol.StatusType;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@@ -51,6 +51,10 @@
|
|||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-common</artifactId>
|
<artifactId>keycloak-common</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<artifactId>keycloak-saml-adapter-api-public</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-saml-adapter-core</artifactId>
|
<artifactId>keycloak-saml-adapter-core</artifactId>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@@ -52,6 +52,10 @@
|
|||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-common</artifactId>
|
<artifactId>keycloak-common</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<artifactId>keycloak-saml-adapter-api-public</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-saml-adapter-core</artifactId>
|
<artifactId>keycloak-saml-adapter-core</artifactId>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../../pom.xml</relativePath>
|
<relativePath>../../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@@ -56,6 +56,10 @@
|
|||||||
<groupId>org.bouncycastle</groupId>
|
<groupId>org.bouncycastle</groupId>
|
||||||
<artifactId>bcprov-jdk15on</artifactId>
|
<artifactId>bcprov-jdk15on</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<artifactId>keycloak-saml-adapter-api-public</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-saml-adapter-core</artifactId>
|
<artifactId>keycloak-saml-adapter-core</artifactId>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<name>Keycloak SAML Jetty Integration</name>
|
<name>Keycloak SAML Jetty Integration</name>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<name>Keycloak SAML Client Adapter Modules</name>
|
<name>Keycloak SAML Client Adapter Modules</name>
|
||||||
@@ -31,6 +31,7 @@
|
|||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
<module>core-public</module>
|
||||||
<module>core</module>
|
<module>core</module>
|
||||||
<module>undertow</module>
|
<module>undertow</module>
|
||||||
<module>tomcat</module>
|
<module>tomcat</module>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-common</artifactId>
|
<artifactId>keycloak-common</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-adapter-spi</artifactId>
|
<artifactId>keycloak-adapter-spi</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
@@ -55,7 +55,11 @@
|
|||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-saml-core</artifactId>
|
<artifactId>keycloak-saml-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<artifactId>keycloak-saml-adapter-api-public</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-saml-adapter-core</artifactId>
|
<artifactId>keycloak-saml-adapter-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
-1
@@ -26,7 +26,6 @@ import org.keycloak.adapters.saml.SamlSession;
|
|||||||
import org.keycloak.adapters.saml.SamlSessionStore;
|
import org.keycloak.adapters.saml.SamlSessionStore;
|
||||||
import org.keycloak.adapters.servlet.FilterSessionStore;
|
import org.keycloak.adapters.servlet.FilterSessionStore;
|
||||||
import org.keycloak.common.util.KeycloakUriBuilder;
|
import org.keycloak.common.util.KeycloakUriBuilder;
|
||||||
import org.keycloak.dom.saml.v2.protocol.StatusType;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletRequestWrapper;
|
import javax.servlet.http.HttpServletRequestWrapper;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-parent</artifactId>
|
<artifactId>keycloak-parent</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../../../pom.xml</relativePath>
|
<relativePath>../../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<name>Keycloak SAML Tomcat Integration</name>
|
<name>Keycloak SAML Tomcat Integration</name>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-saml-tomcat-integration-pom</artifactId>
|
<artifactId>keycloak-saml-tomcat-integration-pom</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-common</artifactId>
|
<artifactId>keycloak-common</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-adapter-spi</artifactId>
|
<artifactId>keycloak-adapter-spi</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
@@ -65,7 +65,11 @@
|
|||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-saml-core</artifactId>
|
<artifactId>keycloak-saml-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
<groupId>org.keycloak</groupId>
|
||||||
|
<artifactId>keycloak-saml-adapter-api-public</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<artifactId>keycloak-saml-adapter-core</artifactId>
|
<artifactId>keycloak-saml-adapter-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
-3
@@ -27,10 +27,7 @@ import org.keycloak.adapters.spi.SessionIdMapper;
|
|||||||
import org.keycloak.adapters.tomcat.CatalinaUserSessionManagement;
|
import org.keycloak.adapters.tomcat.CatalinaUserSessionManagement;
|
||||||
import org.keycloak.adapters.tomcat.GenericPrincipalFactory;
|
import org.keycloak.adapters.tomcat.GenericPrincipalFactory;
|
||||||
import org.keycloak.common.util.KeycloakUriBuilder;
|
import org.keycloak.common.util.KeycloakUriBuilder;
|
||||||
import org.keycloak.dom.saml.v2.protocol.StatusResponseType;
|
|
||||||
import org.keycloak.dom.saml.v2.protocol.StatusType;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-saml-tomcat-integration-pom</artifactId>
|
<artifactId>keycloak-saml-tomcat-integration-pom</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>keycloak-saml-tomcat-integration-pom</artifactId>
|
<artifactId>keycloak-saml-tomcat-integration-pom</artifactId>
|
||||||
<groupId>org.keycloak</groupId>
|
<groupId>org.keycloak</groupId>
|
||||||
<version>1.9.1.Final</version>
|
<version>2.0.0.Test2</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
Loaded 100 of 2244 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user