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