commit | author | age
|
7f7e0c
|
1 |
package org.keycloak.protocol.cas.installation; |
MP |
2 |
|
|
3 |
import org.keycloak.Config; |
|
4 |
import org.keycloak.models.ClientModel; |
|
5 |
import org.keycloak.models.KeycloakSession; |
|
6 |
import org.keycloak.models.KeycloakSessionFactory; |
|
7 |
import org.keycloak.models.RealmModel; |
|
8 |
import org.keycloak.protocol.ClientInstallationProvider; |
|
9 |
import org.keycloak.protocol.cas.CASLoginProtocol; |
37a97a
|
10 |
import org.keycloak.services.resources.RealmsResource; |
7f7e0c
|
11 |
|
MP |
12 |
import javax.ws.rs.core.MediaType; |
|
13 |
import javax.ws.rs.core.Response; |
37a97a
|
14 |
import javax.ws.rs.core.UriBuilder; |
7f7e0c
|
15 |
import java.net.URI; |
MP |
16 |
|
|
17 |
public class KeycloakCASClientInstallation implements ClientInstallationProvider { |
|
18 |
|
|
19 |
@Override |
|
20 |
public Response generateInstallation(KeycloakSession session, RealmModel realm, ClientModel client, URI baseUri) { |
37a97a
|
21 |
UriBuilder bindingUrlBuilder = UriBuilder.fromUri(baseUri); |
MP |
22 |
String bindingUrl = RealmsResource.protocolUrl(bindingUrlBuilder) |
|
23 |
.build(realm.getName(), CASLoginProtocol.LOGIN_PROTOCOL).toString(); |
|
24 |
String description = "CAS Server URL: " + bindingUrl + "\n" + |
|
25 |
"CAS Protocol: CAS 2.0/3.0 (SAML 1.1 is not supported)\n" + |
|
26 |
"Use CAS REST API: false (unsupported)"; |
|
27 |
return Response.ok(description, MediaType.TEXT_PLAIN_TYPE).build(); |
7f7e0c
|
28 |
} |
MP |
29 |
|
|
30 |
@Override |
|
31 |
public String getProtocol() { |
|
32 |
return CASLoginProtocol.LOGIN_PROTOCOL; |
|
33 |
} |
|
34 |
|
|
35 |
@Override |
|
36 |
public String getDisplayType() { |
37a97a
|
37 |
return "Plain CAS configuration"; |
7f7e0c
|
38 |
} |
MP |
39 |
|
|
40 |
@Override |
|
41 |
public String getHelpText() { |
37a97a
|
42 |
return "CAS configuration properties required by CAS clients. Enter the values shown below into the configuration dialog of your client SP."; |
7f7e0c
|
43 |
} |
MP |
44 |
|
|
45 |
@Override |
|
46 |
public void close() { |
|
47 |
|
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
public ClientInstallationProvider create(KeycloakSession session) { |
|
52 |
return this; |
|
53 |
} |
|
54 |
|
|
55 |
@Override |
|
56 |
public void init(Config.Scope config) { |
|
57 |
|
|
58 |
} |
|
59 |
|
|
60 |
@Override |
|
61 |
public void postInit(KeycloakSessionFactory factory) { |
|
62 |
|
|
63 |
} |
|
64 |
|
|
65 |
@Override |
|
66 |
public String getId() { |
37a97a
|
67 |
return "keycloak-cas-text"; |
7f7e0c
|
68 |
} |
MP |
69 |
|
|
70 |
@Override |
|
71 |
public boolean isDownloadOnly() { |
|
72 |
return false; |
|
73 |
} |
|
74 |
|
|
75 |
@Override |
|
76 |
public String getFilename() { |
37a97a
|
77 |
return "keycloak-cas.txt"; |
7f7e0c
|
78 |
} |
MP |
79 |
|
|
80 |
@Override |
|
81 |
public String getMediaType() { |
37a97a
|
82 |
return MediaType.TEXT_PLAIN; |
7f7e0c
|
83 |
} |
MP |
84 |
|
|
85 |
} |