keycloak

keycloak - realm resolution based on username (email address)

亡梦爱人 提交于 2019-12-06 03:29:45
问题 I'm working on a multi tenant project where usernames are actually their email addresses and the domain of the email serves as a tenant identifier. Now in keycloak I'll have different realms per tenant, but I want to have a single login page for all tenants and the actual realm that will do the authentication to be somehow resolved by the username (email address). How do I go about doing that? I found a thread on the mailing list (that I cant find now...) that discussed the same problem. It

Keycloak SSL setup using docker image

别说谁变了你拦得住时间么 提交于 2019-12-06 01:47:03
问题 I am trying to deploy keycloak using docker image (https://hub.docker.com/r/jboss/keycloak/ version 4.5.0-Final) and facing an issue with setting up SSL. According to the docs Keycloak image allows you to specify both a private key and a certificate for serving HTTPS. In that case you need to provide two files: tls.crt - a certificate tls.key - a private key Those files need to be mounted in /etc/x509/https directory. The image will automatically convert them into a Java keystore and

Keycloak User Roles missing in REST API

耗尽温柔 提交于 2019-12-06 00:58:29
I would like to ask, if somebody knows, why there are no roles within the user details in REST ADMIN API request. I saw some posts dealing with this topic, but there were either no clear answer or they propose to use keycloak-admin-client, but that seems not very convenient. Maybe I need to map the roles in Admin console or use claims? Roles are one of the most important user attribute so whats the reason they are not retrieved as other user attributes?Any suggestion? Thanks GET /auth/admin/realms/{realm}/users { "id": "efa7e6c0-139f-44d8-baa8-10822ed2a9c1", "createdTimestamp": 1516707328588,

How to generate jwt token through keycloak rest api?

爱⌒轻易说出口 提交于 2019-12-05 23:36:05
问题 I'm working on integrating Keycloak into an existing application. As part of this process I need to test that the web application can accept jwt tokens generated from keycloak. I have read the API docs http://www.keycloak.org/docs-api/3.4/rest-api/index.html and could not find any methods for creating a jwt token. Does anyone know of any REST api methods for creating a jwt token in Keycloak? 回答1: As per the keycloak mailing list details provided by keycloak mailing list members [Виталий

Keycloak docker HTTPS-REQUIRED with nginx ssl

白昼怎懂夜的黑 提交于 2019-12-05 21:44:48
I am using keycloak for production for the first time. I run keycloak on my local machine and never faced this issue. First I am using docker to run keycloak server. The docker image is pulled from jboss/keycloak . I have set up my SSL using letsEncrypt on my domain test.com After running the docker image I ended up getting error HTTPS-REQUIRED when I click on administrative console. After reading up a lot about this from HERE HERE and HERE I realized I need SSL on my domain which I did. I also pass PROXY_ADDRESS_FORWARDING=true in my docker command. This is how I run it. docker run -e

Access Keycloak REST Admin API using a service account (client credential grant)

拈花ヽ惹草 提交于 2019-12-05 17:44:39
I like to manage keycloak from my own application:create user & clients, display users & client. As this is not a real user but a machine I would like to use a service account with a client credential grant as proposed in How to get Keycloak users via REST without admin account . To realize this I: create a realm inside the real created a client configured the access type of the client to "confidential" saved and activated the "Service Accounts Enabled" option that will apear after the save. enable under scopes the client-roles of the "real-management" (see screenshot) requested an access

How to register a custom ProtocolMapper in Keycloak?

[亡魂溺海] 提交于 2019-12-05 17:34:33
I'm struggling with registering a custom ProtocolMapper in Keycloak. I would like to add some data from my database on token request. So i followed the idea given in Keycloak add extra claims from database / external source . I implemented the ProtocolMapper interface and added the file META-INF/services/org.keycloak.protocol.ProtocolMapper containing the reference to my class. So far so good and Keycloak recognizes the new implementation. I'm also able to configure it via the admin console. To add some data to the token I think I must also add one/some of the interfaces org.keycloak.protocol

keycloak CORS filter spring boot

不想你离开。 提交于 2019-12-05 14:12:23
问题 I am using keycloak to secure my rest service. I am refering to the tutorial given here. I created the rest and front end. Now when I add keycloak on the backend I get CORS error when my front end makes api call. Application.java file in spring boot looks like @SpringBootApplication public class Application { public static void main( String[] args ) { SpringApplication.run(Application.class, args); } @Bean public WebMvcConfigurer corsConfiguration() { return new WebMvcConfigurerAdapter() {

Get username from keycloak session in NodeJS

自古美人都是妖i 提交于 2019-12-05 09:35:52
Is there something similar to: request.getUserPrincipal().getName() // Java In Node to get username when we are using connect-keycloak with express middle-ware? I also came along with this issue. I did dive into the middleware code and tried to find something similar. It turns out that the request object is modified and appended by kauth.grant . console.log('req.kauth.grant') prints out: { access_token: { token: 'kasdgfksj333', clientId: 'mobile', header: { alg: 'RS256' }, content: { jti: '33389eb6-3611-4de2-b913-add9283c3de0', exp: 1464883174, nbf: 0, iat: 1464882874, iss: 'http://docker:9090

Keycloak - Get all Users mapped to roles

╄→гoц情女王★ 提交于 2019-12-05 09:25:34
I know keycloak has exposed below api, <dependency> <groupId>org.keycloak</groupId> <artifactId>keycloak-services</artifactId> <version>2.0.0.Final</version> </dependency> With complete documentation here . I cannot find the required api here to fetch all users with specific role mapped to them. Problem Statement - I need to pick all users from keycloak server who have a specific role. I need to send email to all users with role mapped to them. There is an outstanding feature request asking for this function via the API. In the meantime if your requirement is once-off you could obtain the user