commit | author | age
|
7f7e0c
|
1 |
package org.keycloak.protocol.cas; |
MP |
2 |
|
fdb9f6
|
3 |
import jakarta.ws.rs.Path; |
JK |
4 |
import jakarta.ws.rs.core.Response; |
|
5 |
import jakarta.ws.rs.core.UriBuilder; |
7f7e0c
|
6 |
import org.jboss.resteasy.spi.ResteasyProviderFactory; |
MP |
7 |
import org.keycloak.events.EventBuilder; |
|
8 |
import org.keycloak.models.KeycloakSession; |
|
9 |
import org.keycloak.models.RealmModel; |
74023a
|
10 |
import org.keycloak.protocol.cas.endpoints.*; |
7f7e0c
|
11 |
import org.keycloak.services.resources.RealmsResource; |
MP |
12 |
|
|
13 |
public class CASLoginProtocolService { |
58cce9
|
14 |
private KeycloakSession session; |
7f7e0c
|
15 |
private RealmModel realm; |
MP |
16 |
private EventBuilder event; |
|
17 |
|
58cce9
|
18 |
public CASLoginProtocolService(KeycloakSession session, EventBuilder event) { |
G |
19 |
this.session = session; |
|
20 |
this.realm = session.getContext().getRealm(); |
7f7e0c
|
21 |
this.event = event; |
MP |
22 |
} |
|
23 |
|
|
24 |
public static UriBuilder serviceBaseUrl(UriBuilder baseUriBuilder) { |
|
25 |
return baseUriBuilder.path(RealmsResource.class).path("{realm}/protocol/" + CASLoginProtocol.LOGIN_PROTOCOL); |
|
26 |
} |
|
27 |
|
|
28 |
@Path("login") |
|
29 |
public Object login() { |
58cce9
|
30 |
AuthorizationEndpoint endpoint = new AuthorizationEndpoint(session, event); |
7f7e0c
|
31 |
ResteasyProviderFactory.getInstance().injectProperties(endpoint); |
MP |
32 |
return endpoint; |
|
33 |
} |
|
34 |
|
|
35 |
@Path("logout") |
|
36 |
public Object logout() { |
ceed8f
|
37 |
LogoutEndpoint endpoint = new LogoutEndpoint(session, realm); |
7f7e0c
|
38 |
ResteasyProviderFactory.getInstance().injectProperties(endpoint); |
MP |
39 |
return endpoint; |
|
40 |
} |
|
41 |
|
|
42 |
@Path("validate") |
|
43 |
public Object validate() { |
ceed8f
|
44 |
ValidateEndpoint endpoint = new ValidateEndpoint(session, realm, event); |
7f7e0c
|
45 |
ResteasyProviderFactory.getInstance().injectProperties(endpoint); |
MP |
46 |
return endpoint; |
|
47 |
} |
|
48 |
|
74023a
|
49 |
@Path("samlValidate") |
EH |
50 |
public Object validateSaml11() { |
ceed8f
|
51 |
SamlValidateEndpoint endpoint = new SamlValidateEndpoint(session, realm, event); |
74023a
|
52 |
ResteasyProviderFactory.getInstance().injectProperties(endpoint); |
EH |
53 |
return endpoint; |
|
54 |
} |
|
55 |
|
7f7e0c
|
56 |
@Path("serviceValidate") |
MP |
57 |
public Object serviceValidate() { |
ceed8f
|
58 |
ServiceValidateEndpoint endpoint = new ServiceValidateEndpoint(session, realm, event); |
7f7e0c
|
59 |
ResteasyProviderFactory.getInstance().injectProperties(endpoint); |
MP |
60 |
return endpoint; |
|
61 |
} |
|
62 |
|
|
63 |
@Path("proxyValidate") |
|
64 |
public Object proxyValidate() { |
5a0869
|
65 |
//TODO implement |
MP |
66 |
return serviceValidate(); |
7f7e0c
|
67 |
} |
MP |
68 |
|
|
69 |
@Path("proxy") |
|
70 |
public Object proxy() { |
5a0869
|
71 |
return Response.serverError().entity("Not implemented").build(); |
7f7e0c
|
72 |
} |
MP |
73 |
|
|
74 |
@Path("p3/serviceValidate") |
|
75 |
public Object p3ServiceValidate() { |
|
76 |
return serviceValidate(); |
|
77 |
} |
|
78 |
|
|
79 |
@Path("p3/proxyValidate") |
|
80 |
public Object p3ProxyValidate() { |
|
81 |
return proxyValidate(); |
|
82 |
} |
|
83 |
} |