keycloak

Add protocol-mapper to keycloak using kcadm.sh

走远了吗. 提交于 2019-11-29 16:16:38
I have been trying to setup my full test system in keycloak using the kcadmin cli, but I have some problems creating protocol mappers: HTTP error - 400 Bad Request I have been trying to implement a request using: http://www.keycloak.org/docs-api/3.3/rest-api/index.html http://blog.keycloak.org/2017/01/administer-keycloak-server-from-shell.html Am I missing something in the request: /opt/jboss/keycloak/bin/kcadm.sh create \ clients/7e8ef93b-0d0f-487d-84a5-5cfaee7ddf13/protocol-mappers/models \ -r $test_realm \ -s config.user.attribute=tenants \ -s config.claim.name=tenants \ -s config.jsonType

RESTEASY003145: Unable to find a MessageBodyReader of content-type application/json and type class org.keycloak.representations.AccessTokenResponse

我是研究僧i 提交于 2019-11-29 13:46:44
I'm trying to test Keycloak REST API. Instaled the version 2.1.0.Final. I can access the admin through browser with SSL without problems. I'm using the code above: Keycloak keycloakClient = KeycloakBuilder.builder() .serverUrl("https://keycloak.intra.rps.com.br/auth") .realm("testrealm") .username("development") .password("development") .clientId("admin-cli") .resteasyClient(new ResteasyClientBuilder().connectionPoolSize(10).build()) .build(); List<RealmRepresentation> rr = keycloakClient.realms().findAll(); And got the error: javax.ws.rs.ProcessingException: RESTEASY003145: Unable to find a

Logout user via Keycloak REST API doesn't work

让人想犯罪 __ 提交于 2019-11-29 12:02:53
问题 I have issue while calling Keycloak's logout endpoint from an (mobile) application. This scenario is supported as stated in its documentation: /realms/{realm-name}/protocol/openid-connect/logout The logout endpoint logs out the authenticated user. The user agent can be redirected to the endpoint, in which case the active user session is logged out. Afterward the user agent is redirected back to the application. The endpoint can also be invoked directly by the application. To invoke this

Obtaining user roles in servlet application using keycloak

ぃ、小莉子 提交于 2019-11-29 10:37:40
I'm using keycloak to protect my servlet. I have to add new roles and assign them to users dynamically. It works in keycloak using admin API, but I can't figure out how to obtain the roles for specific user in a servlet. I tried this solution, but I get empty set: protected void doPost(HttpServletRequest request, HttpServletResponse response) { ... KeycloakSecurityContext context = (KeycloakSecurityContext)request.getAttribute(KeycloakSecurityContext.class.getName()); Set<String> roles = AdapterUtils.getRolesFromSecurityContext((RefreshableKeycloakSecurityContext) context); ... } @Shiva's

Keycloak standalone cluster on Cloud Foundry

时光毁灭记忆、已成空白 提交于 2019-11-29 09:01:05
How to configure Keycloak standalone cluster on Cloud Foundry? I tried to use docker image jboss/keycloak:4.5.0.Final with internal routing: env: JGROUPS_DISCOVERY_PROTOCOL: dns.DNS_PING JGROUPS_DISCOVERY_PROPERTIES: dns_query=keycloak-cluster-poc.apps.internal all udp and tcp ports between app instances opened: cf add-network-policy keycloak-cluster-poc --destination-app keycloak-cluster-poc --protocol tcp/udp --port 1-65535 It's not working. Should I expose additional ports? <socket-binding name="jgroups-mping" interface="private" port="0" multicast-address="${jboss.default.multicast.address

Keycloak Client Credentials Flow Clarification

蹲街弑〆低调 提交于 2019-11-29 08:13:45
I am using Keycloak server to implement SSO. I am able to get access token for a specific client using client_credentials flow. However, my observation is that the access token is granted for internal service account of the client . I would like to get access token for other users present in realm by providing some additional parameter to the token endpoint. Below is the current request I make to token endpoint using Postman Chrome extension : POST http://localhost:8080/auth/realms/<realm>/protocol/<protocol>/token x-www-form-urlencoded grant_type client_credentials client_id <client_id>

Is there an API call for changing user password on keycloak?

流过昼夜 提交于 2019-11-29 03:02:17
I am trying to implement my own form for changing a user's password. I tried to find an API for changing a user's password in Keycloak but I couldn't find anything in the documentation. Is there an API for doing it? Christian Kaiser you can use PUT /auth/admin/realms/{realm}/users/{id}/reset-password {id} is the user id in keycloak (not the login) Here is s sample body. { "type": "password", "temporary": false, "value": "my-new-password" } Rather than specifying a new password manually a better security practice is to use the PUT /auth/admin/realms/{realm}/users/{id}/execute-actions-email

Keycloak add extra claims from database / external source

僤鯓⒐⒋嵵緔 提交于 2019-11-29 02:18:23
I have not been able to divine the way I might add extra claims from my application database. Given my limited understanding, I see two ways: After successful authentication have keycloak pull extra claims from the application database somehow. This app database is postgres, for example. Have the application update the jwt with extra claims using a shared key. I would like some feedback both paths. I feel that the fist option may be safer. However I am not sure where to begin that implementation journey. Answering my own question here. I cross-posted this question to the Keycloak users mailing

Configure reverse-proxy for Keycloak docker with custom base URL

心已入冬 提交于 2019-11-28 22:33:38
问题 How can I set the docker keycloak base url as parameter ? I have the following nginx reverse proxy configuration: server { listen 80; server_name example.com; location /keycloak { proxy_pass http://example.com:8087/; } } When I try to access http://example.com/keycloak/ I got a keycloak http redirect to http://example.com/auth/ instead of http://example.com/keycloak/auth/ Any ideas? 回答1: Just tested that @home, and actually multiple configuration additions are needed: 1/ Run the keycloak

Fetch Logged In Username in a webapp secured with Keycloak

梦想与她 提交于 2019-11-28 21:25:31
I have secured an enterprise application with Keycloak using standard wildfly based Keycloak adapters. Issue that I am facing is that the rest web services when invoked, needs to know the username that is currently logged in. How do I get the logged in user information from Keycloak? I tried using SecurityContext , WebListener etc. But none of them are able to give me the required details. You get all user information from the security context. Example: public class Greeter { @Context SecurityContext sc; @GET @Produces(MediaType.APPLICATION_JSON) public String sayHello() { // this will set the