keycloak

Keycloak - Get all Users mapped to roles

时光总嘲笑我的痴心妄想 提交于 2019-12-07 01:50:27
问题 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. 回答1: There is an outstanding feature request

Keycloak: roles not assigned when user is created via CLI

痴心易碎 提交于 2019-12-06 18:51:41
Running the below commands to import user with roles. ./kcadm.sh config credentials --server http://localhost:8080/auth --realm master --user admin --password [pass] ./kcadm.sh create users -r [realm_name] -f user-admin.json user-admin.json looks like: { "username": "adminLocal", "enabled": true, "totp": false, "emailVerified": false, "firstName": "admin", "lastName": "local", "email": "adminLocal@domain.com", "disableableCredentialTypes": ["password"], "requiredActions": [], "notBefore": 0, "access": { "manageGroupMembership": true, "view": true, "mapRoles": true, "impersonate": true, "manage

keycloak bearer token error - Didn't find publicKey for specified kid

↘锁芯ラ 提交于 2019-12-06 14:40:24
I am following this document to secure the rest services. I am able to obtain the access token. However when I try to use the token to invoke a service, I am getting the error - Status: 401 WWW-Authenticate Bearer realm="bkofc", error="invalid_token", error_description="Didn't find publicKey for specified kid" What am I missing here ? Anything to do with the realm settings ? 401 could actually only mean, that the token is not provided correctly. The Header "Authorization" needs to be set properly. It actually works fine, when you are doint it right. Desides, the document you are using is

How to get current user name with Keycloak?

不羁的心 提交于 2019-12-06 12:58:27
问题 I am trying to modify this example Angular2 application to display the currently logged in user. First I tried getting it directly from KeycloakService.tokenParsed.preferred_username but it doesn't seem to exist out of the box with the example code. My guess is that I have to add a function to the KeycloakService to go fetch the user name separately but I am not sure that it is the simplest approach and how to go about this? Solution : Based on @uchihaitachi's suggestion, here's the working

Keycloak Integration with Spring Boot

本小妞迷上赌 提交于 2019-12-06 11:59:01
问题 How to integrate keycloak with a spring boot application. Do we have to give all the resources and its role permission in application.properties? Then what is the use of keycloak.json? Then I need some clarification on those export settings in the admin console of keycloak. Do we have to include that file in the config of application? 回答1: 1) First add these dependencies to your build.gradle (I'm using gradle, but it's the same for pom.xml if you're a Maven guy): // keycloak compile 'org

Keycloak logout does not end session

流过昼夜 提交于 2019-12-06 11:26:49
I am using Keycloak 3.4 in a Java Application using Spring Framework and Jetty 8.1 with Keycloak Jetty-81-Adapter 3.4. According to the Keycloak documentation I should be able to use the HttpServletRequest in a Java EE application to logout from Keycloak. However, this does not work in my case, even though Jetty supports HttpServletRequests. You can log out of a web application in multiple ways. For Java EE servlet containers, you can call HttpServletRequest.logout().. If I try to logout this way, I get redirected to keycloak (login screen with option to choose from multiple realm logins).

Retrieve Keycloak user data using received access token

六月ゝ 毕业季﹏ 提交于 2019-12-06 10:55:34
问题 I am developing a WildFly-Backend (in Java) that accepts HTTP requests (from a custom Frontend) that are signed with the user's Keycloak bearer access token through the "Authorization" HTTP header. The Backend connection itself is already secured with the Keycloak adapter for WildFly, but internally, I want to check who the user is (user groups, name, etc.) and return verying responses. I figured that it would be possible to just send this data from the Frontend, but then people could easily

Is there a way to filter/avoid duplicate attribute names in keycloak SAML assertions?

杀马特。学长 韩版系。学妹 提交于 2019-12-06 09:28:11
I'm trying to setup SSO with nextcloud (13.0.4) and keycloak (4.0.0.Final) (as SSO/SAML IDP und user management solution) like described at SSO with SAML, Keycloak and Nextcloud . However, trying to login to nextcloud with the SSO test user configured in keycloak, nextcloud complaints with the following error: OneLogin_Saml2_ValidationError: Found an Attribute element with duplicated Name /var/www/html/nextcloud/custom_apps/user_saml/3rdparty/vendor/onelogin/php-saml/lib/Saml2/Auth.php - line 177: OneLogin_Saml2_Response->getAttributes() /var/www/html/nextcloud/custom_apps/user_saml/lib

Spring Boot Keycloak - Bearer: How to solve NOT_ATTEMPTED: bearer only?

僤鯓⒐⒋嵵緔 提交于 2019-12-06 09:21:57
问题 Angular v. v4.0.2 Spring Boot v. 1.5.2.RELEASE Keycloak v.2.4.0.Final (will upgrade later) I read this mail converstion about the same problem: http://keycloak-user.88327.x6.nabble.com/keycloak-user-NOT-ATTEMPTED-bearer-only-error-while-trying-to-access-server-from-client-td927.html and this http://slackspace.de/articles/authentication-with-spring-boot-angularjs-and-keycloak/ I use the following http service for making authorized requests: @Injectable() export class AuthHttpService extends

WildFly Postgres DataSource remote connection-url ignored

两盒软妹~` 提交于 2019-12-06 05:32:41
I am running into some configuration troubles in setting up a Keycloak server in standalone clustered mode. Despite configuring the datasource to use a postgres database on {REMOTE_IP} , it is failing to start the server complaining that it cannot connect to localhost:5432 . I've been searching all over but I'm befuddled why the DataSource would try to connect to localhost when the connection-url is set to a remote host. Is there any mistake in my configuration? How can I figure out why PG is trying to connect to localhost instead of {REMOTE_IP} My setup is 1 Postgres database server and 2