From sthorger at redhat.com Mon Sep 3 06:16:32 2018 From: sthorger at redhat.com (Stian Thorgersen) Date: Mon, 3 Sep 2018 12:16:32 +0200 Subject: [keycloak-dev] SAML client integration HTTP 405 error In-Reply-To: References: Message-ID: Please use the user mailing list for general questions and help On Tue, 28 Aug 2018 at 15:02, Adrien DESBIAUX wrote: > Hi there, > > > We are running Keycloak 3.4, and we noticed that for some SAML clients, we > get a HTTP 405 error. > > > This happen for example with client having a local login and a button to > login with SSO. For example Appdynamics does that (to name only that one). > They perform a POST request to the Keycloak SAML endpoint of the configured > client, leading to a HTTP 405 error. > > > The fact that they perform a POST to load the Keycloak login page is > discussable, but how to counter this behaviour on Keycloak client's > configuration side? > > > Thank you in advance for your guidance. > > > Cheers, > _______________________________________________ > keycloak-dev mailing list > keycloak-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/keycloak-dev > From sthorger at redhat.com Mon Sep 3 06:21:20 2018 From: sthorger at redhat.com (Stian Thorgersen) Date: Mon, 3 Sep 2018 12:21:20 +0200 Subject: [keycloak-dev] SCIM v2 support In-Reply-To: <93f62b8abc994e88835f314118fb9f4d@BOSKGEXC01.boskg.local> References: <93f62b8abc994e88835f314118fb9f4d@BOSKGEXC01.boskg.local> Message-ID: Adding additional attributes to user entity is probably not the way to go. Rather, it would be better for backwards compatibility to simply use generic key/value attributes which the user entity already has. Implementing the SCIM endpoints is probably pretty straightforward. Most of the work will probably be down to testing and documentation. On Wed, 29 Aug 2018 at 13:28, L?sch, Sebastian < Sebastian.Loesch at governikus.de> wrote: > Hello, > > > > in a customer project we use keycloak and need a SCIM (System for > Cross-domain Identity Management) API. > > Currently we write a wrapper API and a custom endpoint providing the SCIM > functionality. We wrote a extension of the UserEntity, UserModel and an > extension of the JpaUserProvider. > > This strategy seems not ideal and the nicest way is to add this extensions > to Keycloak. This is already suggested in > https://issues.jboss.org/browse/KEYCLOAK-2537 > > Is anybody out there who can guide me, what coding would be necessary to > contribute the SCIM functionality? > > > > Currently I think we have to: > > - extend the UserEntity with all SCIM attributes. This will result > in additional tables/entities for complex attributes e.g. Address, Name, > Email > > - extend the UserModel to povide the additional attributes > > - implement the new SCIM endpoint /Users > > - make the additional attributes available via Admin REST API > /users > > - extend views to be able to edit SCIM user attributes using the > web ui > > - ? > > - All the above again for the Groups endpoint? > > > > This also seem to be major changes. To big for one Pull Request. How do you > like to handle this? > > > > Best regards, > > Sebastian > > > > > > _______________________________________________ > keycloak-dev mailing list > keycloak-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/keycloak-dev From sthorger at redhat.com Mon Sep 3 06:22:20 2018 From: sthorger at redhat.com (Stian Thorgersen) Date: Mon, 3 Sep 2018 12:22:20 +0200 Subject: [keycloak-dev] Implementing user self service via REST APIs In-Reply-To: References: Message-ID: We are working on account management REST API. Some of it's already available in master and the remaining functionality will come in the next few releases. On Thu, 30 Aug 2018 at 17:47, William Jones wrote: > Hi > > As part of my Keycloak implementation, I would like to offer user self > service, e.g. change password. > > I do not wish to theme the built-in user account dashboard, but instead > build the functionality directly into our website. > > We are already using the Admin API for user administration, but as I > understand it, it would not be appropriate to use this for actions which > are actually being carried out by the end user. The auditing would be > incorrect, and certain functionality is unavailable anyway - for example, > whilst we could set a new user password via the Admin API, we would have no > way of verifying that the existing user password is correct (we want the > user to provide existing and new, as per the user account dashboard). > > As such, is the correct approach to this for us to extend KeyCloak with a > set of custom REST endpoints to be called by an end user rather than an > admin? They will be authenticated at this point so we will be able to pass > down their access token for the authentication. > > If so, I assume I should be following the instructions under "Add custom > REST endpoints" detailed at the following URL? > > https://www.keycloak.org/docs/3.0/server_development/topics/extensions.html > Extending Server | Keycloak Documentation< > https://www.keycloak.org/docs/3.0/server_development/topics/extensions.html > > > This is a very powerful extension, which allows you to deploy your own > REST endpoints to the Keycloak server. It enables all kinds of extensions, > for example the possibility to trigger functionality on the Keycloak > server, which is not available through the default set of built-in Keycloak > REST endpoints. > www.keycloak.org > > > Thanks > > William > > _______________________________________________ > keycloak-dev mailing list > keycloak-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/keycloak-dev > From in.anand19 at gmail.com Mon Sep 3 08:06:38 2018 From: in.anand19 at gmail.com (Mahendra Anand) Date: Mon, 3 Sep 2018 17:36:38 +0530 Subject: [keycloak-dev] 403, Forbidden Issue with POST, PUT, DELETE Message-ID: Hi Team, I am trying to setup a standalone keycloak server and able to do it. With the help of keycloak I am trying to secure REST endpoints which I am exposing in my spring boot application. I have all required steps to configure keycloak with spring boot application link - - creating new realm. - Creating new client in that realm. - new admin and user roles - creating users with admin and user roles. I am able to get access token with the help of admin user like below - curl -d "grant_type=password&client_id=product-app&username=admin&password=admin" http://localhost:8181/auth/realms/springboot/protocol/openid-connect/token And with the help of retrieved token i have able to hit GET end points of my application. But when I do POST, PUT, DELETE requests with token i get -- { "timestamp": "2018-09-03T11:27:16.266+0000", "status": 403, "error": "Forbidden", "message": "Forbidden", "path": "/ds/api/v1/template/create" } It might be a scope issue on the user I am creating, but I am not getting any pointer to give correct scope to user. Kindly suggest any pointer or help will be very much appreciated. Thanks! -- Regards Mahendra Anand Mobile - +91 9711429614 Skype - mahendra.anand From adesbiaux at vente-privee.com Mon Sep 3 08:14:47 2018 From: adesbiaux at vente-privee.com (Adrien DESBIAUX) Date: Mon, 3 Sep 2018 12:14:47 +0000 Subject: [keycloak-dev] SAML client integration HTTP 405 error In-Reply-To: References: , Message-ID: Hi Stian, I would think that my question directly referred to an implementation detail in Keycloak itself. But thank you for your time. ________________________________ From: Stian Thorgersen Sent: Monday, September 3, 2018 12:16:32 PM To: Adrien DESBIAUX Cc: keycloak-dev Subject: Re: [keycloak-dev] SAML client integration HTTP 405 error Please use the user mailing list for general questions and help On Tue, 28 Aug 2018 at 15:02, Adrien DESBIAUX > wrote: Hi there, We are running Keycloak 3.4, and we noticed that for some SAML clients, we get a HTTP 405 error. This happen for example with client having a local login and a button to login with SSO. For example Appdynamics does that (to name only that one). They perform a POST request to the Keycloak SAML endpoint of the configured client, leading to a HTTP 405 error. The fact that they perform a POST to load the Keycloak login page is discussable, but how to counter this behaviour on Keycloak client's configuration side? Thank you in advance for your guidance. Cheers, _______________________________________________ keycloak-dev mailing list keycloak-dev at lists.jboss.org https://lists.jboss.org/mailman/listinfo/keycloak-dev From hmlnarik at redhat.com Mon Sep 3 08:33:05 2018 From: hmlnarik at redhat.com (Hynek Mlnarik) Date: Mon, 3 Sep 2018 14:33:05 +0200 Subject: [keycloak-dev] SAML client integration HTTP 405 error In-Reply-To: References: Message-ID: Please send this use-case question to keycloak-user with relevant details of configurations and error logs. On Mon, Sep 3, 2018 at 2:25 PM Adrien DESBIAUX wrote: > Hi Stian, > > > I would think that my question directly referred to an implementation > detail in Keycloak itself. > > > But thank you for your time. > > > > > > > ________________________________ > From: Stian Thorgersen > Sent: Monday, September 3, 2018 12:16:32 PM > To: Adrien DESBIAUX > Cc: keycloak-dev > Subject: Re: [keycloak-dev] SAML client integration HTTP 405 error > > Please use the user mailing list for general questions and help > > On Tue, 28 Aug 2018 at 15:02, Adrien DESBIAUX > wrote: > Hi there, > > > We are running Keycloak 3.4, and we noticed that for some SAML clients, we > get a HTTP 405 error. > > > This happen for example with client having a local login and a button to > login with SSO. For example Appdynamics does that (to name only that one). > They perform a POST request to the Keycloak SAML endpoint of the configured > client, leading to a HTTP 405 error. > > > The fact that they perform a POST to load the Keycloak login page is > discussable, but how to counter this behaviour on Keycloak client's > configuration side? > > > Thank you in advance for your guidance. > > > Cheers, > _______________________________________________ > keycloak-dev mailing list > keycloak-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/keycloak-dev< > https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.jboss.org_mailman_listinfo_keycloak-2Ddev&d=DwMFaQ&c=8G9fL-FODW3I-fESjFvsaw&r=BhQIS0sALperhBRJRNzxM3Ax9g4k8rNIuzNmM35TMgE&m=72xRw4Glpv6dKcdXHkNdMWSdUO2SnV-al0GTcZGzDiE&s=_Q5d2-MpbXWlpKgBC0-nBHGbv6HpUu6ucLAhQjfFK-o&e= > > > _______________________________________________ > keycloak-dev mailing list > keycloak-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/keycloak-dev > From Sebastian.Loesch at governikus.de Tue Sep 4 02:40:56 2018 From: Sebastian.Loesch at governikus.de (=?utf-8?B?TMO2c2NoLCBTZWJhc3RpYW4=?=) Date: Tue, 4 Sep 2018 06:40:56 +0000 Subject: [keycloak-dev] SCIM v2 support In-Reply-To: References: <93f62b8abc994e88835f314118fb9f4d@BOSKGEXC01.boskg.local> Message-ID: Hello Stian, thank you for your input. Storing additional SCIM attributes as key/value pairs in the USER_ATTRIBUTE table has two drawbacks: - Storing of multivalued complex attributes becomes difficult. E.g. the SCIM phone number type has 4 attributes ?value?, ?display?, ?type? and ?primary? and each user may have many phone number objects. - Searching for users by attributes becomes difficult und maybe has a bad performance because of the SQL. Do you still think that?s the preferred way to go? Best regards, Sebastian Von: Stian Thorgersen Gesendet: Montag, 3. September 2018 12:21 An: L?sch, Sebastian Cc: keycloak-dev Betreff: Re: [keycloak-dev] SCIM v2 support Adding additional attributes to user entity is probably not the way to go. Rather, it would be better for backwards compatibility to simply use generic key/value attributes which the user entity already has. Implementing the SCIM endpoints is probably pretty straightforward. Most of the work will probably be down to testing and documentation. On Wed, 29 Aug 2018 at 13:28, L?sch, Sebastian > wrote: Hello, in a customer project we use keycloak and need a SCIM (System for Cross-domain Identity Management) API. Currently we write a wrapper API and a custom endpoint providing the SCIM functionality. We wrote a extension of the UserEntity, UserModel and an extension of the JpaUserProvider. This strategy seems not ideal and the nicest way is to add this extensions to Keycloak. This is already suggested in https://issues.jboss.org/browse/KEYCLOAK-2537 Is anybody out there who can guide me, what coding would be necessary to contribute the SCIM functionality? Currently I think we have to: - extend the UserEntity with all SCIM attributes. This will result in additional tables/entities for complex attributes e.g. Address, Name, Email - extend the UserModel to povide the additional attributes - implement the new SCIM endpoint /Users - make the additional attributes available via Admin REST API /users - extend views to be able to edit SCIM user attributes using the web ui - ? - All the above again for the Groups endpoint? This also seem to be major changes. To big for one Pull Request. How do you like to handle this? Best regards, Sebastian _______________________________________________ keycloak-dev mailing list keycloak-dev at lists.jboss.org https://lists.jboss.org/mailman/listinfo/keycloak-dev From Sebastian.Schuster at bosch-si.com Tue Sep 4 03:50:34 2018 From: Sebastian.Schuster at bosch-si.com (Schuster Sebastian (INST-CSS/BSV-OS)) Date: Tue, 4 Sep 2018 07:50:34 +0000 Subject: [keycloak-dev] Potential performance regression between 3.4.3.Final and 4.3.0.Final In-Reply-To: References: <3de878395d3f4e4f8dd5e872d9e41e98@bosch-si.com> Message-ID: <3f90f66ead604b27ae0862e84a1fd224@bosch-si.com> Hi Hynek, I did a little testing. In my setup I have a local MS SQL DB with 170.495 users and 18.663.024 user attributes. That?s in the order of our targeted production setup. Without your change, listing users basically times out, I never get a response. With your change not fetching the user attributes I get an answer after 150 ms. I also tested what happens if I change the fetchtype to ?select? of all one-to-many relations in UserEntity with a batch size of 20 (just an initial guess as that?s the default page size in the UI). Then I get the list of users in 1100ms instead of timing out (after setting briefRepresentation to false). I read a little bit in the Hibernate documentation and they wrote that fetchmode.subselect loads all entities into the session and only makes sense when nearly all entities should be loaded anyways. I?d guess that?s mostly not true for Users in Keycloak. Also not for Resources, the only other place I found a subselect relation. I would conclude going back to fetchtype.select with a batch size of 20 is definitely superior to the subselect that?s currently used, independently of your change. It?s just 6 lines of code change. ? I could prepare a pull request for that but I have to go through some nasty processes on our side so that might take a while? Best regards, Sebastian Mit freundlichen Gr??en / Best regards Dr.-Ing. Sebastian Schuster Engineering and Support (INST/ESY1) Bosch Software Innovations GmbH | Ullsteinstr. 128 | 12109 Berlin | GERMANY | www.bosch-si.com Tel. +49 30 726112-485 | Fax +49 30 726112-100 | Sebastian.Schuster at bosch-si.com Sitz: Berlin, Registergericht: Amtsgericht Charlottenburg; HRB 148411 B Aufsichtsratsvorsitzender: Dr.-Ing. Thorsten L?cke; Gesch?ftsf?hrung: Dr. Stefan Ferber, Michael Hahn From: Hynek Mlnarik Sent: Freitag, 31. August 2018 18:38 To: Thomas Darimont Cc: Schuster Sebastian (INST/ESY1) ; Stian Thorgersen ; keycloak-dev Subject: Re: [keycloak-dev] Potential performance regression between 3.4.3.Final and 4.3.0.Final Hi Thomas, the issue with repeating a query should be addressed by [1]. Out of curiosity, I wonder whether you'd have some spare time to test this change in your environment? Thanks --Hynek [1] https://github.com/keycloak/keycloak/pull/5525 On Thu, Aug 30, 2018 at 12:58 PM Hynek Mlnarik > wrote: Hi Sebastian, Thomas, I agree that this query is bad performance-wise. It is caused inability of database to easily limit rows in the resultset of query that joins users and attributes (and other tables) if there might are several attributes per user while we want to return exactly n users (the LIMIT/OFFSET won't work here for parent table due to joining with child records). Hibernate thus resorts to its own filtering of the full resultset. That is one option, the other is having subsequent selects and limiting batch size. Both approaches have pros and cons, and actually the subsequent selects were changed to subselects precisely because of performance. Looks like we might need to revert back to the select approach and tweak batch size. That will require some time for optimizations. For now, the most painful issue with user list seems resolved and thus I'm merging the PR. There will be subsequent work though on further optimizations to user / user list retrieval, that relates to both your suggestion and Thomas's comment (that relates to authz resource server store caching). Thank you both for your help! --Hynek On Thu, Aug 30, 2018 at 12:06 PM Schuster Sebastian (INST/ESY1) > wrote: Hi Thomas, Your query is the same as before, it is the initial retrieval of the user entity. The query I am referring to is the one loading the user attributes after the user entity has been fetched as part of ModelToRepresentation.toRepresentation(KeycloakSession session, RealmModel realm, UserModel user). It just looks wrong to me that all users are fetched when only the attributes of a single user are needed. However, with Hynek?s change, the user attributes are no longer fetched because only a BriefRepresentation is requested, that?s why it is faster now. I still think a full representation should also be faster and not fetch all users from a realm. Best regards, Sebastian Mit freundlichen Gr??en / Best regards Dr.-Ing. Sebastian Schuster Engineering and Support (INST/ESY1) Bosch Software Innovations GmbH | Ullsteinstr. 128 | 12109 Berlin | GERMANY | www.bosch-si.com Tel. +49 30 726112-485 | Fax +49 30 726112-100 | Sebastian.Schuster at bosch-si.com Sitz: Berlin, Registergericht: Amtsgericht Charlottenburg; HRB 148411 B Aufsichtsratsvorsitzender: Dr.-Ing. Thorsten L?cke; Gesch?ftsf?hrung: Dr. Stefan Ferber, Michael Hahn From: Thomas Darimont > Sent: Mittwoch, 29. August 2018 22:55 To: Schuster Sebastian (INST/ESY1) > Cc: Hynek Mlnarik >; Stian Thorgersen >; keycloak-dev > Subject: Re: [keycloak-dev] Potential performance regression between 3.4.3.Final and 4.3.0.Final Hello Hynek et al., I gave your PR 5517 a quick spin and tested the user listing in the admin-console on my Dell XPS (3.4GHz, 32g) laptop with local PostgreSQL backend. I can confirm that the response times for loading a single page in the user-listing are much better now with your fix: In a test realm with 10k users, loading a single page takes ~15ms compared to 8 seconds (!) before. The new query that is now generated whilst browsing the user list looks like this: Hibernate: select userentity0_.ID as ID1_75_, userentity0_.CREATED_TIMESTAMP as CREATED_2_75_, userentity0_.EMAIL as EMAIL3_75_, userentity0_.EMAIL_CONSTRAINT as EMAIL_CO4_75_, userentity0_.EMAIL_VERIFIED as EMAIL_VE5_75_, userentity0_.ENABLED as ENABLED6_75_, userentity0_.FEDERATION_LINK as FEDERATI7_75_, userentity0_.FIRST_NAME as FIRST_NA8_75_, userentity0_.LAST_NAME as LAST_NAM9_75_, userentity0_.NOT_BEFORE as NOT_BEF10_75_, userentity0_.REALM_ID as REALM_I11_75_, userentity0_.SERVICE_ACCOUNT_CLIENT_LINK as SERVICE12_75_, userentity0_.USERNAME as USERNAM13_75_ from USER_ENTITY userentity0_ where userentity0_.REALM_ID=? and ( userentity0_.SERVICE_ACCOUNT_CLIENT_LINK is null ) order by userentity0_.USERNAME limit ? offset ? The query looks reasonable with appropriate limits applied. However, it seems that policies are fetched for each returned user via a dedicated query, e.g.: select resourcese0_.ID as ID1_64_0_, resourcese0_.ALLOW_RS_REMOTE_MGMT as ALLOW_RS2_64_0_, resourcese0_.POLICY_ENFORCE_MODE as POLICY_E3_64_0_ from RESOURCE_SERVER resourcese0_ where resourcese0_.ID=? Would it be possible to load those in one batch? Cheers, Thomas Am Mi., 29. Aug. 2018 um 17:19 Uhr schrieb Schuster Sebastian (INST/ESY1) >: Thanks Hynek, I?ll test this. I also tracked the issue down to the ModelToRepresentation.toRepresentation(KeycloakSession session, RealmModel realm, UserModel user) method. However, what I am also seeing is when the method is running, it is emitting SQL queries that are not scoped down to the user id of the user being transformed. E.g. for the user attributes of a user the following query is generated: select attributes0_.USER_ID as USER_ID4_72_1_, attributes0_.ID as ID1_72_1_, attributes0_.ID as ID1_72_0_, attributes0_.NAME as NAME2_72_0_, attributes0_.USER_ID as USER_ID4_72_0_, attributes0_.VALUE as VALUE3_72_0_ from USER_ATTRIBUTE attributes0_ where attributes0_.USER_ID in ( select userentity0_.ID from USER_ENTITY userentity0_ where userentity0_.REALM_ID=? and ( userentity0_.SERVICE_ACCOUNT_CLIENT_LINK is null ) ) The subselect returns all real users from the realm. It is neither paged nor bound to a specific user id. The same happens in the above method for credentials and required actions. I am not a JPA/Hibernate expert so I might be missing something here? Best regards, Sebastian Mit freundlichen Gr??en / Best regards Dr.-Ing. Sebastian Schuster Engineering and Support (INST/ESY1) Bosch Software Innovations GmbH | Ullsteinstr. 128 | 12109 Berlin | GERMANY | www.bosch-si.com Tel. +49 30 726112-485 | Fax +49 30 726112-100 | Sebastian.Schuster at bosch-si.com Sitz: Berlin, Registergericht: Amtsgericht Charlottenburg; HRB 148411 B Aufsichtsratsvorsitzender: Dr.-Ing. Thorsten L?cke; Gesch?ftsf?hrung: Dr. Stefan Ferber, Michael Hahn From: Hynek Mlnarik > Sent: Mittwoch, 29. August 2018 16:35 To: Thomas Darimont > Cc: Stian Thorgersen >; keycloak-dev >; Schuster Sebastian (INST/ESY1) > Subject: Re: [keycloak-dev] Potential performance regression between 3.4.3.Final and 4.3.0.Final Thanks Thomas and all, great help with reproducing the issue at least for admin user list endpoint. Could you please test [1] that it indeed fixes the issue? It was caused obtaining too much user details when unnecessary (for user list, only few fields are necessary). As for increased memory requirements, these might be unrelated to this fix, and we'll keep an eye on this. --Hynek [1] https://github.com/keycloak/keycloak/pull/5517 On Mon, Aug 27, 2018 at 4:48 PM Thomas Darimont > wrote: Hello, FYI I created https://issues.jboss.org/browse/KEYCLOAK-8150 Cheers, Thomas Am Mo., 27. Aug. 2018 um 13:33 Uhr schrieb Stian Thorgersen < sthorger at redhat.com>: > Can you open a bug for this in JIRA please and include as much details as > you can. > > On Thu, 23 Aug 2018 at 15:45, Thomas Darimont < > thomas.darimont at googlemail.com> wrote: > >> Hi Sebastian, >> >> thanks for investigating! Unfortunately, I didn't have time yet to look >> further into the problem, but I also observed the slow attributes handling. >> Btw. we have around 100k users and ~700k attributes. The >> Entity-Attribute-Value data model takes it's toll here... >> >> @Stian so far I've only observed this when scrolling through the user >> overview in the admin-console, which also triggers >> the mentioned spike in heap usage. >> >> Cheers, >> Thomas >> >> Am Do., 23. Aug. 2018 um 15:22 Uhr schrieb Schuster Sebastian (INST/ESY1) >> >: >> >>> Btw. we also have 40K user attributes... >>> >>> Best regards, >>> Sebastian >>> >>> Mit freundlichen Gr??en / Best regards >>> >>> Dr.-Ing. Sebastian Schuster >>> >>> Engineering and Support (INST/ESY1) >>> Bosch Software Innovations GmbH | Ullsteinstr. 128 | 12109 Berlin | >>> GERMANY | www.bosch-si.com >>> Tel. +49 30 726112-485 | Fax +49 30 726112-100 | >>> Sebastian.Schuster at bosch-si.com >>> >>> Sitz: Berlin, Registergericht: Amtsgericht Charlottenburg; HRB 148411 B >>> Aufsichtsratsvorsitzender: Dr.-Ing. Thorsten L?cke; Gesch?ftsf?hrung: >>> Dr. Stefan Ferber, Michael Hahn >>> >>> >>> >>> >>> -----Original Message----- >>> From: keycloak-dev-bounces at lists.jboss.org < >>> keycloak-dev-bounces at lists.jboss.org> On Behalf Of Stian Thorgersen >>> Sent: Mittwoch, 22. August 2018 21:25 >>> To: Thomas Darimont > >>> Cc: keycloak-dev > >>> Subject: Re: [keycloak-dev] Potential performance regression between >>> 3.4.3.Final and 4.3.0.Final >>> >>> That's quite worrying. Is it limited to browsing users through the admin >>> console or are you seeing bad behaviour elsewhere? Same question applies to >>> the heap. My best bet here is that it has that something has changed around >>> user querying/caching. >>> >>> On Mon, 20 Aug 2018 at 19:18, Thomas Darimont < >>> thomas.darimont at googlemail.com> wrote: >>> >>> > Hello Keycloak team, >>> > >>> > has anyone encountered some performance issues after upgrading 3.4.3 >>> > to 4.x (4.3.0)? >>> > >>> > Today I noticed a performance regression while preparing an upgrade >>> > from Keycloak 3.4.3.Final to 4.3.0.Final in our staging environment. >>> > >>> > In our test environment, we have around ~100k test users stored in a >>> > postgres-backed database. When we started the server with the new >>> > Keycloak version, the migration went through, and everything looked >>> > fine at first, but when we tried to browse the list of users via the >>> > admin-console, we noticed that the CPU and memory consumption of the >>> > server increased significantly, up to a point where Keycloak crashed >>> with an OOME. >>> > >>> > All previous Keycloak versions including 3.4.3 were very modest with >>> > their memory requirements and quite happy with ~1g heap. >>> > However, that seems to have changed in Keycloak 4.3.0 - there we >>> > needed at least 4g to prevent Keycloak from crashing with an OOME. >>> > Furthermore, we noticed that the response times for browsing the >>> > paginated user view increased significantly as well: >>> > In Keycloak 3.4.3 the average time to load a user page is ~80ms. In >>> > Keycloak 4.3.0 (and older versions >= 4.0.0.Beta1) the same operation >>> > takes >>> > ~7 seconds for a test realm with just 10k users. >>> > >>> > In the test realm with 100k users, the time to load a single page in >>> > the users listing was 66 seconds for version 4.3.0, on average - >>> > compared to quite stable 80ms in 3.4.3. >>> > >>> > The database query that is executed by Keycloak 4.3.0 runs in ~1.5 >>> > seconds for 100k users, so I assume the processing logic in Keycloak >>> > is the culprit. >>> > >>> > The problem of long load-times can be reproduced with the Keycloak >>> > docker images and the in-memory database. I also created a small >>> > example project that creates some users with just a few attributes in >>> > a docker based 3.4.3 and 4.3.0 Keycloak environment with a Postgres >>> > database to reproduce the problem. >>> > https://github.com/thomasdarimont/kc-user-regression-tester >>> > >>> > Cheers, >>> > Thomas >>> > _______________________________________________ >>> > keycloak-dev mailing list >>> > keycloak-dev at lists.jboss.org >>> > https://lists.jboss.org/mailman/listinfo/keycloak-dev >>> > >>> _______________________________________________ >>> keycloak-dev mailing list >>> keycloak-dev at lists.jboss.org >>> https://lists.jboss.org/mailman/listinfo/keycloak-dev >>> >> _______________________________________________ keycloak-dev mailing list keycloak-dev at lists.jboss.org https://lists.jboss.org/mailman/listinfo/keycloak-dev From hmlnarik at redhat.com Tue Sep 4 04:54:48 2018 From: hmlnarik at redhat.com (Hynek Mlnarik) Date: Tue, 4 Sep 2018 10:54:48 +0200 Subject: [keycloak-dev] Potential performance regression between 3.4.3.Final and 4.3.0.Final In-Reply-To: <3f90f66ead604b27ae0862e84a1fd224@bosch-si.com> References: <3de878395d3f4e4f8dd5e872d9e41e98@bosch-si.com> <3f90f66ead604b27ae0862e84a1fd224@bosch-si.com> Message-ID: Hi Sebastian, thanks for checking on your dataset, really appreciated! PR would be welcome, I believe batch size of 20 makes sense at least for this PR, we can optimize further if if that is not sufficient. Please refer to KEYCLOAK-8222 in the commit. --Hynek On Tue, Sep 4, 2018 at 9:51 AM Schuster Sebastian (INST-CSS/BSV-OS) < Sebastian.Schuster at bosch-si.com> wrote: > Hi Hynek, > > > > I did a little testing. In my setup I have a local MS SQL DB with 170.495 > users and 18.663.024 user attributes. That?s in the order of our targeted > production setup. > > > > Without your change, listing users basically times out, I never get a > response. > > With your change not fetching the user attributes I get an answer after > 150 ms. > > > > I also tested what happens if I change the fetchtype to ?select? of all > one-to-many relations in UserEntity with a batch size of 20 (just an > initial guess as that?s the default page size in the UI). > > Then I get the list of users in 1100ms instead of timing out (after > setting briefRepresentation to false). > > > > I read a little bit in the Hibernate documentation and they wrote that > fetchmode.subselect loads all entities into the session and only makes > sense when nearly all entities should be loaded anyways. I?d guess that?s > mostly not true for Users in Keycloak. Also not for Resources, the only > other place I found a subselect relation. > > > > I would conclude going back to fetchtype.select with a batch size of 20 is > definitely superior to the subselect that?s currently used, independently > of your change. > > It?s just 6 lines of code change. J I could prepare a pull request for > that but I have to go through some nasty processes on our side so that > might take a while? > > > > Best regards, > > Sebastian > > > > Mit freundlichen Gr??en / Best regards > > > *Dr.-Ing. Sebastian Schuster * > Engineering and Support (INST/ESY1) > Bosch Software Innovations GmbH | Ullsteinstr. 128 | 12109 Berlin | > GERMANY | www.bosch-si.com > Tel. +49 30 726112-485 | Fax +49 30 726112-100 | > Sebastian.Schuster at bosch-si.com > > Sitz: Berlin, Registergericht: Amtsgericht Charlottenburg; HRB 148411 B > Aufsichtsratsvorsitzender: Dr.-Ing. Thorsten L?cke; Gesch?ftsf?hrung: Dr. > Stefan Ferber, Michael Hahn > > > > *From:* Hynek Mlnarik > *Sent:* Freitag, 31. August 2018 18:38 > *To:* Thomas Darimont > *Cc:* Schuster Sebastian (INST/ESY1) ; > Stian Thorgersen ; keycloak-dev < > keycloak-dev at lists.jboss.org> > *Subject:* Re: [keycloak-dev] Potential performance regression between > 3.4.3.Final and 4.3.0.Final > > > > Hi Thomas, > > > > the issue with repeating a query should be addressed by [1]. Out of > curiosity, I wonder whether you'd have some spare time to test this change > in your environment? > > > > Thanks > > > > --Hynek > > > > [1] https://github.com/keycloak/keycloak/pull/5525 > > > > > > > > On Thu, Aug 30, 2018 at 12:58 PM Hynek Mlnarik > wrote: > > Hi Sebastian, Thomas, > > > > I agree that this query is bad performance-wise. It is caused inability of > database to easily limit rows in the resultset of query that joins users > and attributes (and other tables) if there might are several attributes per > user while we want to return exactly n users (the LIMIT/OFFSET won't work > here for parent table due to joining with child records). Hibernate thus > resorts to its own filtering of the full resultset. That is one option, the > other is having subsequent selects and limiting batch size. Both approaches > have pros and cons, and actually the subsequent selects were changed to > subselects precisely because of performance. Looks like we might need to > revert back to the select approach and tweak batch size. That will require > some time for optimizations. > > > > For now, the most painful issue with user list seems resolved and thus I'm > merging the PR. There will be subsequent work though on further > optimizations to user / user list retrieval, that relates to both your > suggestion and Thomas's comment (that relates to authz resource server > store caching). Thank you both for your help! > > > > --Hynek > > > > > > On Thu, Aug 30, 2018 at 12:06 PM Schuster Sebastian (INST/ESY1) < > Sebastian.Schuster at bosch-si.com> wrote: > > Hi Thomas, > > > > Your query is the same as before, it is the initial retrieval of the user > entity. The query I am referring to is the one loading the user attributes > after the user entity has been fetched as part of > ModelToRepresentation.toRepresentation(KeycloakSession session, RealmModel > realm, UserModel user). It just looks wrong to me that all users are > fetched when only the attributes of a single user are needed. However, with > Hynek?s change, the user attributes are no longer fetched because only a > BriefRepresentation is requested, that?s why it is faster now. I still > think a full representation should also be faster and not fetch all users > from a realm. > > > > Best regards, > > Sebastian > > > > Mit freundlichen Gr??en / Best regards > > > *Dr.-Ing. Sebastian Schuster * > Engineering and Support (INST/ESY1) > Bosch Software Innovations GmbH | Ullsteinstr. 128 | 12109 Berlin | > GERMANY | www.bosch-si.com > Tel. +49 30 726112-485 | Fax +49 30 726112-100 | > Sebastian.Schuster at bosch-si.com > > Sitz: Berlin, Registergericht: Amtsgericht Charlottenburg; HRB 148411 B > Aufsichtsratsvorsitzender: Dr.-Ing. Thorsten L?cke; Gesch?ftsf?hrung: Dr. > Stefan Ferber, Michael Hahn > > > *From:* Thomas Darimont > *Sent:* Mittwoch, 29. August 2018 22:55 > *To:* Schuster Sebastian (INST/ESY1) > *Cc:* Hynek Mlnarik ; Stian Thorgersen < > stian at redhat.com>; keycloak-dev > *Subject:* Re: [keycloak-dev] Potential performance regression between > 3.4.3.Final and 4.3.0.Final > > > > Hello Hynek et al., > > > > I gave your PR 5517 a quick spin and tested the user listing in the > admin-console on my Dell XPS (3.4GHz, 32g) laptop with local PostgreSQL > backend. > > I can confirm that the response times for loading a single page in the > user-listing are much better now with your fix: > > In a test realm with 10k users, loading a single page takes ~15ms compared > to 8 seconds (!) before. > > > > The new query that is now generated whilst browsing the user list looks > like this: > > > > Hibernate: > > select > > userentity0_.ID as ID1_75_, > > userentity0_.CREATED_TIMESTAMP as CREATED_2_75_, > > userentity0_.EMAIL as EMAIL3_75_, > > userentity0_.EMAIL_CONSTRAINT as EMAIL_CO4_75_, > > userentity0_.EMAIL_VERIFIED as EMAIL_VE5_75_, > > userentity0_.ENABLED as ENABLED6_75_, > > userentity0_.FEDERATION_LINK as FEDERATI7_75_, > > userentity0_.FIRST_NAME as FIRST_NA8_75_, > > userentity0_.LAST_NAME as LAST_NAM9_75_, > > userentity0_.NOT_BEFORE as NOT_BEF10_75_, > > userentity0_.REALM_ID as REALM_I11_75_, > > userentity0_.SERVICE_ACCOUNT_CLIENT_LINK as SERVICE12_75_, > > userentity0_.USERNAME as USERNAM13_75_ > > from > > USER_ENTITY userentity0_ > > where > > userentity0_.REALM_ID=? > > and ( > > userentity0_.SERVICE_ACCOUNT_CLIENT_LINK is null > > ) > > order by > > userentity0_.USERNAME limit ? offset ? > > > > The query looks reasonable with appropriate limits applied. > > > > However, it seems that policies are fetched for each returned user via a > dedicated query, e.g.: > > > > select > > resourcese0_.ID as ID1_64_0_, > > resourcese0_.ALLOW_RS_REMOTE_MGMT as ALLOW_RS2_64_0_, > > resourcese0_.POLICY_ENFORCE_MODE as POLICY_E3_64_0_ > > from > > RESOURCE_SERVER resourcese0_ > > where > > resourcese0_.ID=? > > > > Would it be possible to load those in one batch? > > > > Cheers, > > Thomas > > > > Am Mi., 29. Aug. 2018 um 17:19 Uhr schrieb Schuster Sebastian (INST/ESY1) < > Sebastian.Schuster at bosch-si.com>: > > Thanks Hynek, I?ll test this. I also tracked the issue down to the > ModelToRepresentation.toRepresentation(KeycloakSession session, RealmModel > realm, UserModel user) method. However, what I am also seeing is when the > method is running, it is emitting SQL queries that are not scoped down to > the user id of the user being transformed. E.g. for the user attributes of > a user the following query is generated: > > > > select > > attributes0_.USER_ID as USER_ID4_72_1_, > > attributes0_.ID as ID1_72_1_, > > attributes0_.ID as ID1_72_0_, > > attributes0_.NAME as NAME2_72_0_, > > attributes0_.USER_ID as USER_ID4_72_0_, > > attributes0_.VALUE as VALUE3_72_0_ > > from > > USER_ATTRIBUTE attributes0_ > > where > > attributes0_.USER_ID in ( > > select > > userentity0_.ID > > from > > USER_ENTITY userentity0_ > > where > > userentity0_.REALM_ID=? > > and ( > > userentity0_.SERVICE_ACCOUNT_CLIENT_LINK is null > > ) > > ) > > > > The subselect returns all real users from the realm. It is neither paged > nor bound to a specific user id. The same happens in the above method for > credentials and required actions. I am not a JPA/Hibernate expert so I > might be missing something here? > > > > Best regards, > > Sebastian > > > > Mit freundlichen Gr??en / Best regards > > > *Dr.-Ing. Sebastian Schuster * > Engineering and Support (INST/ESY1) > Bosch Software Innovations GmbH | Ullsteinstr. 128 | 12109 Berlin | > GERMANY | www.bosch-si.com > Tel. +49 30 726112-485 | Fax +49 30 726112-100 | > Sebastian.Schuster at bosch-si.com > > Sitz: Berlin, Registergericht: Amtsgericht Charlottenburg; HRB 148411 B > Aufsichtsratsvorsitzender: Dr.-Ing. Thorsten L?cke; Gesch?ftsf?hrung: Dr. > Stefan Ferber, Michael Hahn > > *From:* Hynek Mlnarik > *Sent:* Mittwoch, 29. August 2018 16:35 > *To:* Thomas Darimont > *Cc:* Stian Thorgersen ; keycloak-dev < > keycloak-dev at lists.jboss.org>; Schuster Sebastian (INST/ESY1) < > Sebastian.Schuster at bosch-si.com> > *Subject:* Re: [keycloak-dev] Potential performance regression between > 3.4.3.Final and 4.3.0.Final > > > > Thanks Thomas and all, > > > > great help with reproducing the issue at least for admin user list > endpoint. Could you please test [1] that it indeed fixes the issue? It was > caused obtaining too much user details when unnecessary (for user list, > only few fields are necessary). > > > > As for increased memory requirements, these might be unrelated to this > fix, and we'll keep an eye on this. > > > > --Hynek > > > > [1] https://github.com/keycloak/keycloak/pull/5517 > > > > > > > > On Mon, Aug 27, 2018 at 4:48 PM Thomas Darimont < > thomas.darimont at googlemail.com> wrote: > > Hello, > > FYI I created https://issues.jboss.org/browse/KEYCLOAK-8150 > > Cheers, > Thomas > > Am Mo., 27. Aug. 2018 um 13:33 Uhr schrieb Stian Thorgersen < > sthorger at redhat.com>: > > > Can you open a bug for this in JIRA please and include as much details as > > you can. > > > > On Thu, 23 Aug 2018 at 15:45, Thomas Darimont < > > thomas.darimont at googlemail.com> wrote: > > > >> Hi Sebastian, > >> > >> thanks for investigating! Unfortunately, I didn't have time yet to look > >> further into the problem, but I also observed the slow attributes > handling. > >> Btw. we have around 100k users and ~700k attributes. The > >> Entity-Attribute-Value data model takes it's toll here... > >> > >> @Stian so far I've only observed this when scrolling through the user > >> overview in the admin-console, which also triggers > >> the mentioned spike in heap usage. > >> > >> Cheers, > >> Thomas > >> > >> Am Do., 23. Aug. 2018 um 15:22 Uhr schrieb Schuster Sebastian > (INST/ESY1) > >> : > >> > >>> Btw. we also have 40K user attributes... > >>> > >>> Best regards, > >>> Sebastian > >>> > >>> Mit freundlichen Gr??en / Best regards > >>> > >>> Dr.-Ing. Sebastian Schuster > >>> > >>> Engineering and Support (INST/ESY1) > >>> Bosch Software Innovations GmbH | Ullsteinstr. 128 | 12109 Berlin | > >>> GERMANY | www.bosch-si.com > >>> Tel. +49 30 726112-485 | Fax +49 30 726112-100 | > >>> Sebastian.Schuster at bosch-si.com > >>> > >>> Sitz: Berlin, Registergericht: Amtsgericht Charlottenburg; HRB 148411 B > >>> Aufsichtsratsvorsitzender: Dr.-Ing. Thorsten L?cke; Gesch?ftsf?hrung: > >>> Dr. Stefan Ferber, Michael Hahn > >>> > >>> > >>> > >>> > >>> -----Original Message----- > >>> From: keycloak-dev-bounces at lists.jboss.org < > >>> keycloak-dev-bounces at lists.jboss.org> On Behalf Of Stian Thorgersen > >>> Sent: Mittwoch, 22. August 2018 21:25 > >>> To: Thomas Darimont > >>> Cc: keycloak-dev > >>> Subject: Re: [keycloak-dev] Potential performance regression between > >>> 3.4.3.Final and 4.3.0.Final > >>> > >>> That's quite worrying. Is it limited to browsing users through the > admin > >>> console or are you seeing bad behaviour elsewhere? Same question > applies to > >>> the heap. My best bet here is that it has that something has changed > around > >>> user querying/caching. > >>> > >>> On Mon, 20 Aug 2018 at 19:18, Thomas Darimont < > >>> thomas.darimont at googlemail.com> wrote: > >>> > >>> > Hello Keycloak team, > >>> > > >>> > has anyone encountered some performance issues after upgrading 3.4.3 > >>> > to 4.x (4.3.0)? > >>> > > >>> > Today I noticed a performance regression while preparing an upgrade > >>> > from Keycloak 3.4.3.Final to 4.3.0.Final in our staging environment. > >>> > > >>> > In our test environment, we have around ~100k test users stored in a > >>> > postgres-backed database. When we started the server with the new > >>> > Keycloak version, the migration went through, and everything looked > >>> > fine at first, but when we tried to browse the list of users via the > >>> > admin-console, we noticed that the CPU and memory consumption of the > >>> > server increased significantly, up to a point where Keycloak crashed > >>> with an OOME. > >>> > > >>> > All previous Keycloak versions including 3.4.3 were very modest with > >>> > their memory requirements and quite happy with ~1g heap. > >>> > However, that seems to have changed in Keycloak 4.3.0 - there we > >>> > needed at least 4g to prevent Keycloak from crashing with an OOME. > >>> > Furthermore, we noticed that the response times for browsing the > >>> > paginated user view increased significantly as well: > >>> > In Keycloak 3.4.3 the average time to load a user page is ~80ms. In > >>> > Keycloak 4.3.0 (and older versions >= 4.0.0.Beta1) the same operation > >>> > takes > >>> > ~7 seconds for a test realm with just 10k users. > >>> > > >>> > In the test realm with 100k users, the time to load a single page in > >>> > the users listing was 66 seconds for version 4.3.0, on average - > >>> > compared to quite stable 80ms in 3.4.3. > >>> > > >>> > The database query that is executed by Keycloak 4.3.0 runs in ~1.5 > >>> > seconds for 100k users, so I assume the processing logic in Keycloak > >>> > is the culprit. > >>> > > >>> > The problem of long load-times can be reproduced with the Keycloak > >>> > docker images and the in-memory database. I also created a small > >>> > example project that creates some users with just a few attributes in > >>> > a docker based 3.4.3 and 4.3.0 Keycloak environment with a Postgres > >>> > database to reproduce the problem. > >>> > https://github.com/thomasdarimont/kc-user-regression-tester > >>> > > >>> > Cheers, > >>> > Thomas > >>> > _______________________________________________ > >>> > keycloak-dev mailing list > >>> > keycloak-dev at lists.jboss.org > >>> > https://lists.jboss.org/mailman/listinfo/keycloak-dev > >>> > > >>> _______________________________________________ > >>> keycloak-dev mailing list > >>> keycloak-dev at lists.jboss.org > >>> https://lists.jboss.org/mailman/listinfo/keycloak-dev > >>> > >> > _______________________________________________ > keycloak-dev mailing list > keycloak-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/keycloak-dev > > From sthorger at redhat.com Tue Sep 4 06:15:06 2018 From: sthorger at redhat.com (Stian Thorgersen) Date: Tue, 4 Sep 2018 12:15:06 +0200 Subject: [keycloak-dev] SCIM v2 support In-Reply-To: References: <93f62b8abc994e88835f314118fb9f4d@BOSKGEXC01.boskg.local> Message-ID: It's not ideal, but adding columns for every additional attribute is also far from ideal. Then there's the issue with backwards compatibility with regards to user storage providers as that is a supported SPI and the API needs to remain backwards compatible. An complicating factor for SCIM will be user storage providers. Attributes, queries, etc. should all work when there are user storage providers in the realm. These could be LDAP or a custom implementation. Queries on attributes shouldn't be to bad as long as the query is written properly. On Tue, 4 Sep 2018 at 08:41, L?sch, Sebastian < Sebastian.Loesch at governikus.de> wrote: > Hello Stian, > > > > thank you for your input. Storing additional SCIM attributes as key/value > pairs in the USER_ATTRIBUTE table has two drawbacks: > > - Storing of multivalued complex attributes becomes difficult. > E.g. the SCIM phone number type has 4 attributes ?value?, ?display?, ?type? > and ?primary? and each user may have many phone number objects. > > - Searching for users by attributes becomes difficult und maybe > has a bad performance because of the SQL. > > Do you still think that?s the preferred way to go? > > > > Best regards, > > Sebastian > > > > *Von:* Stian Thorgersen > *Gesendet:* Montag, 3. September 2018 12:21 > *An:* L?sch, Sebastian > *Cc:* keycloak-dev > *Betreff:* Re: [keycloak-dev] SCIM v2 support > > > > Adding additional attributes to user entity is probably not the way to go. > Rather, it would be better for backwards compatibility to simply use > generic key/value attributes which the user entity already has. > > > > Implementing the SCIM endpoints is probably pretty straightforward. Most > of the work will probably be down to testing and documentation. > > On Wed, 29 Aug 2018 at 13:28, L?sch, Sebastian < > Sebastian.Loesch at governikus.de> wrote: > > Hello, > > > > in a customer project we use keycloak and need a SCIM (System for > Cross-domain Identity Management) API. > > Currently we write a wrapper API and a custom endpoint providing the SCIM > functionality. We wrote a extension of the UserEntity, UserModel and an > extension of the JpaUserProvider. > > This strategy seems not ideal and the nicest way is to add this extensions > to Keycloak. This is already suggested in > https://issues.jboss.org/browse/KEYCLOAK-2537 > > Is anybody out there who can guide me, what coding would be necessary to > contribute the SCIM functionality? > > > > Currently I think we have to: > > - extend the UserEntity with all SCIM attributes. This will result > in additional tables/entities for complex attributes e.g. Address, Name, > Email > > - extend the UserModel to povide the additional attributes > > - implement the new SCIM endpoint /Users > > - make the additional attributes available via Admin REST API > /users > > - extend views to be able to edit SCIM user attributes using the > web ui > > - ? > > - All the above again for the Groups endpoint? > > > > This also seem to be major changes. To big for one Pull Request. How do you > like to handle this? > > > > Best regards, > > Sebastian > > > > > > _______________________________________________ > keycloak-dev mailing list > keycloak-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/keycloak-dev > > From tushardhole at hotmail.com Tue Sep 4 08:29:17 2018 From: tushardhole at hotmail.com (tushar dhole) Date: Tue, 4 Sep 2018 12:29:17 +0000 Subject: [keycloak-dev] Keycloak large token issue Message-ID: Hello Community, There is a limitation with keycloak to support large number of realms. Following is the existing jira issue related to same, https://issues.jboss.org/browse/KEYCLOAK-1268 I was wondering if we can solve this following approach, 1. Make the token for users under "master" realm not return all realm info. 2. We can just allow a token from "realm": "master" any for cross realm authorization 3. For all other non master realm the token will be same as that of today If this approach is feasible/doable, then I can dig into the code and try to implement this. But would first like to know if this is really a feasible/doable one. Thanks a lot, Tushar Dhole [KEYCLOAK-1268] Token for admin becomes to large with many ... issues.jboss.org I have a big problem here because of bearer token size. I'm using keycloak within a SaaS application, so I need create alot of realms. From sthorger at redhat.com Tue Sep 4 09:29:20 2018 From: sthorger at redhat.com (Stian Thorgersen) Date: Tue, 4 Sep 2018 15:29:20 +0200 Subject: [keycloak-dev] Permission for client scopes Message-ID: As scopes are often used for permissions in the applications themselves it would be useful to have a mechanism to grant a user access to a scope. For example if you have the scopes "photos:view" and "photos:edit" you would like only users that are permitted to use the photos application to be able to get those scopes in the token. One simple way of doing this would be to have a optional required role associated with a client scope. Then we can simply apply the client scopes for which the user has the required role. From sthorger at redhat.com Tue Sep 4 15:10:52 2018 From: sthorger at redhat.com (Stian Thorgersen) Date: Tue, 4 Sep 2018 21:10:52 +0200 Subject: [keycloak-dev] Keycloak large token issue In-Reply-To: References: Message-ID: This should already be resolved and the tokens issues to the admin console should not contain all roles anymore. Have you tried this with the latest release? On Tue, 4 Sep 2018 at 14:30, tushar dhole wrote: > Hello Community, > > There is a limitation with keycloak to support large number of realms. > Following is the existing jira issue related to same, > > > https://issues.jboss.org/browse/KEYCLOAK-1268 > > > I was wondering if we can solve this following approach, > > > 1. Make the token for users under "master" realm not return all realm > info. > 2. We can just allow a token from "realm": "master" any for cross realm > authorization > 3. For all other non master realm the token will be same as that of > today > > > If this approach is feasible/doable, then I can dig into the code and try > to implement this. > But would first like to know if this is really a feasible/doable one. > > Thanks a lot, > Tushar Dhole > > [KEYCLOAK-1268] Token for admin becomes to large with many ...< > https://issues.jboss.org/browse/KEYCLOAK-1268> > issues.jboss.org > I have a big problem here because of bearer token size. I'm using keycloak > within a SaaS application, so I need create alot of realms. > > > > > > _______________________________________________ > keycloak-dev mailing list > keycloak-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/keycloak-dev > From tushardhole at hotmail.com Tue Sep 4 22:56:58 2018 From: tushardhole at hotmail.com (tushar dhole) Date: Wed, 5 Sep 2018 02:56:58 +0000 Subject: [keycloak-dev] Keycloak large token issue In-Reply-To: References: , Message-ID: Oh that's great .. Thanks.. I will try latest... Get Outlook for Android From: Stian Thorgersen Sent: Wednesday, 5 September, 12:41 am Subject: Re: [keycloak-dev] Keycloak large token issue To: tushardhole at hotmail.com Cc: keycloak-dev This should already be resolved and the tokens issues to the admin console should not contain all roles anymore. Have you tried this with the latest release? On Tue, 4 Sep 2018 at 14:30, tushar dhole > wrote: Hello Community, There is a limitation with keycloak to support large number of realms. Following is the existing jira issue related to same, https://issues.jboss.org/browse/KEYCLOAK-1268 I was wondering if we can solve this following approach, 1. Make the token for users under "master" realm not return all realm info. 2. We can just allow a token from "realm": "master" any for cross realm authorization 3. For all other non master realm the token will be same as that of today If this approach is feasible/doable, then I can dig into the code and try to implement this. But would first like to know if this is really a feasible/doable one. Thanks a lot, Tushar Dhole [KEYCLOAK-1268] Token for admin becomes to large with many ... issues.jboss.org I have a big problem here because of bearer token size. I'm using keycloak within a SaaS application, so I need create alot of realms. _______________________________________________ keycloak-dev mailing list keycloak-dev at lists.jboss.org https://lists.jboss.org/mailman/listinfo/keycloak-dev From pasik at iki.fi Wed Sep 5 10:03:03 2018 From: pasik at iki.fi (Pasi =?iso-8859-1?Q?K=E4rkk=E4inen?=) Date: Wed, 5 Sep 2018 17:03:03 +0300 Subject: [keycloak-dev] Permission for client scopes In-Reply-To: References: Message-ID: <20180905140303.GB18222@reaktio.net> On Tue, Sep 04, 2018 at 03:29:20PM +0200, Stian Thorgersen wrote: > As scopes are often used for permissions in the applications themselves it > would be useful to have a mechanism to grant a user access to a scope. > > For example if you have the scopes "photos:view" and "photos:edit" you > would like only users that are permitted to use the photos application to > be able to get those scopes in the token. > > One simple way of doing this would be to have a optional required role > associated with a client scope. Then we can simply apply the client scopes > for which the user has the required role. > +1 Something like this is definitely needed and useful in Keycloak. I guess this is: https://issues.jboss.org/browse/KEYCLOAK-8175 -- Pasi From mposolda at redhat.com Thu Sep 6 16:28:13 2018 From: mposolda at redhat.com (Marek Posolda) Date: Thu, 6 Sep 2018 22:28:13 +0200 Subject: [keycloak-dev] Audience support Message-ID: <2deecc7b-f8b1-c2c0-a958-abc3bd2eed43@redhat.com> Hi, I have some concerns about the audience support. The prototype done few months ago, which I have in my branch [1] is based on client scopes. I showed it on the weekly demo some time ago and changed few things based on the feedback. Just to clarify, the PR: - Adds the AudienceProtocolMapper, which is able to attach single client_id of the specified client (typically will be bearer-only client) - Adds the easy way to generate "audience client scope" for specified "service" client (usually bearer-only client). This clientScope contains: -- the audienceProtocolMapper of bearer-only described above -- the scope role mappings of all the client roles of that bearer-only client. The "frontend" clients can then use this clientScope, so that audience + roleMappings will be both available in the accessToken issued for the frontend-client. Now there is this specs [2], which Pedro pointed. Short summary about this specs: - It is still in draft state for few years and there are some TODO in it. So hard to say how much to rely on it... - It specifically talks about "scope" parameter and mentions, that it is often used by various parties for "what the token can be used for" (permissions/claims associated with the token) and "where to use that token" . But it mentions that "where" use-case should be ideally handled by something else. - It introduces "resource" parameter, which MUST be an absolute URI per this specification and it should point to the service/resource where the access token will be used. When authorization server is creating token, it may apply audiences, encrypt token by various algorithms based on the requested "resource" etc. For the audience, they specify that: "The authorization server may use the exact 'resource' value as the audience or it may map from that value to a more general URI or abstract identifier for the resource server." - The "resource" parameter is used in the token request if possible. For the grants where it's not possible (implicit, resource owner password login, client credentials) it is used in the initial authentication request. So for the classic "authorization_code" grant it can be used in code-to-token or refresh-token requests. This is great and allows some cool flexibility (unlike "scope" where the whole SSO login including all the redirects is needed). But it requires some support on adapters. Now I am thinking about 2 possible ways to continue: 1) Finish my current work around audience and for now, let it be driven through the "scope" parameter. Then later add the support for the "resource" parameter and the specs above. 2) Skip what I currently have and start something different based on the "resource" parameter specs. ATM I am more keen to option 1, so that we can have some audience support in master ASAP. Also because the specs is still draft and I don't know how much we can rely on the "resource" parameter being adopted by 3rd party applications (for example Openshift). When we later have the option to drive audiences through both "scope" and "resource" params, it will be good thing IMO. The "resource" related support will require changes on the adapter side as it is new parameter to be supported in code-to-token request and refresh-token request. On our adapter's side, it will be good to have some changes to allow "cache" of more access tokens for various resources/audiences, not just one. On server-side, I was thinking about various possibilities, and it still looks good to represent "resource" support through client scopes. So optional clientScopes can be requested either through "scope" parameter (default case) or through "resource" parameter (probably disabled by default) or through both. Thoughts? [1] https://github.com/mposolda/keycloak/tree/audience [2] https://tools.ietf.org/html/draft-ietf-oauth-resource-indicators-00 Marek From sthorger at redhat.com Fri Sep 7 02:20:45 2018 From: sthorger at redhat.com (Stian Thorgersen) Date: Fri, 7 Sep 2018 08:20:45 +0200 Subject: [keycloak-dev] Keycloak 4.4.0.Final is out Message-ID: https://www.keycloak.org/docs/latest/release_notes/index.html From ian at ianduffy.ie Fri Sep 7 05:31:58 2018 From: ian at ianduffy.ie (Ian Duffy) Date: Fri, 7 Sep 2018 10:31:58 +0100 Subject: [keycloak-dev] Keycloak 4.4.0.Final is out Message-ID: Hi all, Glad to see the Keycloak 4.4.0 release, the image seems to be missing from Docker Hub. https://hub.docker.com/r/jboss/keycloak/tags/ Is there anything that can be done to fix this? Thanks, Ian. From it.vidhyadharan at gmail.com Sun Sep 9 13:11:16 2018 From: it.vidhyadharan at gmail.com (vidhyadharan D) Date: Sun, 9 Sep 2018 22:41:16 +0530 Subject: [keycloak-dev] Regarding https://issues.jboss.org/browse/KEYCLOAK-8162 Message-ID: Hi Experts, I have been working on keycloak html email. I am in need to embed logo to the emails i.e. from the *themes/email/resources/img/logo.png * In the login module there is a way to locate image / favicon via ${url.resourcesPath} However in email module we dont have access to locate the resources.. I have achieved by adding custom email template provider. If possible please add these into email module because it is useful for all . or let me know i can provide PR. https://issues.jboss.org/browse/KEYCLOAK-8162 Thanks, vidhya From sthorger at redhat.com Mon Sep 10 02:57:28 2018 From: sthorger at redhat.com (Stian Thorgersen) Date: Mon, 10 Sep 2018 08:57:28 +0200 Subject: [keycloak-dev] Keycloak 4.4.0.Final is out In-Reply-To: References: Message-ID: Build on its way now. On Fri, 7 Sep 2018 at 11:32, Ian Duffy wrote: > Hi all, > > Glad to see the Keycloak 4.4.0 release, the image seems to be missing from > Docker Hub. > > https://hub.docker.com/r/jboss/keycloak/tags/ > > Is there anything that can be done to fix this? > > Thanks, > Ian. > From sthorger at redhat.com Mon Sep 10 03:15:59 2018 From: sthorger at redhat.com (Stian Thorgersen) Date: Mon, 10 Sep 2018 09:15:59 +0200 Subject: [keycloak-dev] Regarding https://issues.jboss.org/browse/KEYCLOAK-8162 In-Reply-To: References: Message-ID: For emails shouldn't images actually be encoded into the email itself rather than linked to? On Sun, 9 Sep 2018 at 19:18, vidhyadharan D wrote: > Hi Experts, > > I have been working on keycloak html email. I am in need to embed logo to > the emails i.e. from the *themes/email/resources/img/logo.png * > > In the login module there is a way to locate image / favicon via > ${url.resourcesPath} > > However in email module we dont have access to locate the resources.. > > I have achieved by adding custom email template provider. If possible > please add these into email module because it is useful for all . > > or let me know i can provide PR. > > https://issues.jboss.org/browse/KEYCLOAK-8162 > > > Thanks, > vidhya > _______________________________________________ > keycloak-dev mailing list > keycloak-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/keycloak-dev > From sthorger at redhat.com Mon Sep 10 03:21:00 2018 From: sthorger at redhat.com (Stian Thorgersen) Date: Mon, 10 Sep 2018 09:21:00 +0200 Subject: [keycloak-dev] Audience support In-Reply-To: <2deecc7b-f8b1-c2c0-a958-abc3bd2eed43@redhat.com> References: <2deecc7b-f8b1-c2c0-a958-abc3bd2eed43@redhat.com> Message-ID: As aud field is widely used today that is what we need now. I haven't seen anyone ask for [2] so I think we can safely ignore that spec for now. I would finish what you have with aud support for now, then we can address [2] in the future if needed. On Thu, 6 Sep 2018 at 23:37, Marek Posolda wrote: > Hi, > > I have some concerns about the audience support. The prototype done few > months ago, which I have in my branch [1] is based on client scopes. I > showed it on the weekly demo some time ago and changed few things based > on the feedback. Just to clarify, the PR: > - Adds the AudienceProtocolMapper, which is able to attach single > client_id of the specified client (typically will be bearer-only client) > > - Adds the easy way to generate "audience client scope" for specified > "service" client (usually bearer-only client). This clientScope contains: > -- the audienceProtocolMapper of bearer-only described above > -- the scope role mappings of all the client roles of that bearer-only > client. > The "frontend" clients can then use this clientScope, so that audience + > roleMappings will be both available in the accessToken issued for the > frontend-client. > > Now there is this specs [2], which Pedro pointed. Short summary about > this specs: > > - It is still in draft state for few years and there are some TODO in > it. So hard to say how much to rely on it... > > - It specifically talks about "scope" parameter and mentions, that it is > often used by various parties for "what the token can be used for" > (permissions/claims associated with the token) and "where to use that > token" . But it mentions that "where" use-case should be ideally handled > by something else. > > - It introduces "resource" parameter, which MUST be an absolute URI per > this specification and it should point to the service/resource where the > access token will be used. When authorization server is creating token, > it may apply audiences, encrypt token by various algorithms based on the > requested "resource" etc. For the audience, they specify that: > > "The authorization server may use the exact 'resource' value as the > audience or it may map from that value to a more general URI or abstract > identifier for the resource server." > > - The "resource" parameter is used in the token request if possible. For > the grants where it's not possible (implicit, resource owner password > login, client credentials) it is used in the initial authentication > request. So for the classic "authorization_code" grant it can be used in > code-to-token or refresh-token requests. This is great and allows some > cool flexibility (unlike "scope" where the whole SSO login including all > the redirects is needed). But it requires some support on adapters. > > > Now I am thinking about 2 possible ways to continue: > > 1) Finish my current work around audience and for now, let it be driven > through the "scope" parameter. Then later add the support for the > "resource" parameter and the specs above. > 2) Skip what I currently have and start something different based on the > "resource" parameter specs. > > ATM I am more keen to option 1, so that we can have some audience > support in master ASAP. Also because the specs is still draft and I > don't know how much we can rely on the "resource" parameter being > adopted by 3rd party applications (for example Openshift). When we later > have the option to drive audiences through both "scope" and "resource" > params, it will be good thing IMO. > > The "resource" related support will require changes on the adapter side > as it is new parameter to be supported in code-to-token request and > refresh-token request. On our adapter's side, it will be good to have > some changes to allow "cache" of more access tokens for various > resources/audiences, not just one. On server-side, I was thinking about > various possibilities, and it still looks good to represent "resource" > support through client scopes. So optional clientScopes can be requested > either through "scope" parameter (default case) or through "resource" > parameter (probably disabled by default) or through both. > > Thoughts? > > > [1] https://github.com/mposolda/keycloak/tree/audience > [2] https://tools.ietf.org/html/draft-ietf-oauth-resource-indicators-00 > > Marek > > _______________________________________________ > keycloak-dev mailing list > keycloak-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/keycloak-dev > From sthorger at redhat.com Mon Sep 10 03:22:07 2018 From: sthorger at redhat.com (Stian Thorgersen) Date: Mon, 10 Sep 2018 09:22:07 +0200 Subject: [keycloak-dev] Possible feature: role attributes In-Reply-To: <365a8b409e5248908b2eb312a6d202bc@bosch-si.com> References: <10b624a57cea40a1bcc9bd77b63b398a@bosch-si.com> <365a8b409e5248908b2eb312a6d202bc@bosch-si.com> Message-ID: Sounds good. I can't think of anything that you've missed from the list. On Fri, 31 Aug 2018 at 15:46, Schuster Sebastian (INST/ESY1) < Sebastian.Schuster at bosch-si.com> wrote: > All right. I would like to create a prototype for this. I would take > inspiration from the way custom group attributes are currently implemented. > > I guess changes would be necessary in the following areas: > > ? DB schema > > ? Persistence layer > > ? Caching layer > > ? CRUD API > > ? Admin console > > ? Admin CLI > > ? Java client > > ? Admin events > > Anything I missed? > > > > Thanks and best regards, > > Sebastian > > > > Mit freundlichen Gr??en / Best regards > > > *Dr.-Ing. Sebastian Schuster * > Engineering and Support (INST/ESY1) > Bosch Software Innovations GmbH | Ullsteinstr. 128 | 12109 Berlin | > GERMANY | www.bosch-si.com > Tel. +49 30 726112-485 | Fax +49 30 726112-100 | > Sebastian.Schuster at bosch-si.com > > Sitz: Berlin, Registergericht: Amtsgericht Charlottenburg; HRB 148411 B > Aufsichtsratsvorsitzender: Dr.-Ing. Thorsten L?cke; Gesch?ftsf?hrung: Dr. > Stefan Ferber, Michael Hahn > > > > *From:* Stian Thorgersen > *Sent:* Montag, 27. August 2018 13:49 > *To:* Schuster Sebastian (INST/ESY1) > *Cc:* keycloak-dev > *Subject:* Re: [keycloak-dev] Possible feature: role attributes > > > > I don't think we need to consider adding role attributes to the token. > That would very quickly bloat tokens. > > > > I would like to see a bit more general use of role attributes as part of > incorporating such a feature. Otherwise it would end up being a rather > hidden feature. Some ideas I have in mind: > > > > * Ability to do crud of role attributes in admin console > > * Ability to query for roles based on attributes > > > > For future work it would be great to have attributes on everything. That > would allow us to do something like OpenShift `oc` does. Where you're able > to search and delete everything based on attributes. One nice use-case here > is that you can tag all clients, roles, etc.. that belong to a deployment > (a group of apps and services) and be able to view everything that is > related to the deployment in Keycloak. > > > > On Mon, 27 Aug 2018 at 13:32, Schuster Sebastian (INST/ESY1) < > Sebastian.Schuster at bosch-si.com> wrote: > > Hi everybody, > > We have a use case where we would like to store additional > meta-information for roles. This come from our IAM-requirements, that say > there is a single responsible person for a role or that roles give access > to data with different classifications. One way to store this kind of > information would be to introduce role attributes to client and realm > roles, basically similar to user or group attributes. > > For us, it would be sufficient to have this information purely as > metadata, i.e. we would only read it through the audit log to inform the > responsible person about role assignments if a role with a certain > classification is assigned. In contrast to that, you can add group und user > attributes to a token using user attribute mappers and the client > application can extract this information from the token and act on it. > > WDYT? Does anybody else have similar requirements? Would you need role > custom attributes also in the token? I can imagine that it gets kind of > difficult to identify where attributes come from, once there are user, > group, and role attributes, possibly with inheritance/composition. > > Best regards, > Sebastian > > Mit freundlichen Gr??en / Best regards > > Dr.-Ing. Sebastian Schuster > > Engineering and Support (INST/ESY1) > Bosch Software Innovations GmbH | Ullsteinstr. 128 | 12109 Berlin | > GERMANY | www.bosch-si.com > Tel. +49 30 726112-485 | Fax +49 30 726112-100 | > Sebastian.Schuster at bosch-si.com > > Sitz: Berlin, Registergericht: Amtsgericht Charlottenburg; HRB 148411 B > Aufsichtsratsvorsitzender: Dr.-Ing. Thorsten L?cke; Gesch?ftsf?hrung: Dr. > Stefan Ferber, Michael Hahn > > > > _______________________________________________ > keycloak-dev mailing list > keycloak-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/keycloak-dev > > From mposolda at redhat.com Mon Sep 10 03:37:05 2018 From: mposolda at redhat.com (Marek Posolda) Date: Mon, 10 Sep 2018 09:37:05 +0200 Subject: [keycloak-dev] Audience support In-Reply-To: References: <2deecc7b-f8b1-c2c0-a958-abc3bd2eed43@redhat.com> Message-ID: Cool, should have audience PR ready in next few days then. Will create "future" version JIRA for the "Resource" specs. Marek On 10/09/18 09:21, Stian Thorgersen wrote: > As aud field is widely used today that is what we need now. I haven't > seen anyone ask for [2] so I think we can safely ignore that spec for > now. > > I would finish what you have with aud support for now, then we can > address [2] in the future if needed. > > On Thu, 6 Sep 2018 at 23:37, Marek Posolda > wrote: > > Hi, > > I have some concerns about the audience support. The prototype > done few > months ago, which I have in my branch [1] is based on client > scopes. I > showed it on the weekly demo some time ago and changed few things > based > on the feedback. Just to clarify, the PR: > - Adds the AudienceProtocolMapper, which is able to attach single > client_id of the specified client (typically will be bearer-only > client) > > - Adds the easy way to generate "audience client scope" for specified > "service" client (usually bearer-only client). This clientScope > contains: > -- the audienceProtocolMapper of bearer-only described above > -- the scope role mappings of all the client roles of that > bearer-only > client. > The "frontend" clients can then use this clientScope, so that > audience + > roleMappings will be both available in the accessToken issued for the > frontend-client. > > Now there is this specs [2], which Pedro pointed. Short summary about > this specs: > > - It is still in draft state for few years and there are some TODO in > it. So hard to say how much to rely on it... > > - It specifically talks about "scope" parameter and mentions, that > it is > often used by various parties for "what the token can be used for" > (permissions/claims associated with the token) and "where to use that > token" . But it mentions that "where" use-case should be ideally > handled > by something else. > > - It introduces "resource" parameter, which MUST be an absolute > URI per > this specification and it should point to the service/resource > where the > access token will be used. When authorization server is creating > token, > it may apply audiences, encrypt token by various algorithms based > on the > requested "resource" etc. For the audience, they specify that: > > "The authorization server may use the exact 'resource' value as the > audience or it may map from that value to a more general URI or > abstract > identifier for the resource server." > > - The "resource" parameter is used in the token request if > possible. For > the grants where it's not possible (implicit, resource owner password > login, client credentials) it is used in the initial authentication > request. So for the classic "authorization_code" grant it can be > used in > code-to-token or refresh-token requests. This is great and allows > some > cool flexibility (unlike "scope" where the whole SSO login > including all > the redirects is needed). But it requires some support on adapters. > > > Now I am thinking about 2 possible ways to continue: > > 1) Finish my current work around audience and for now, let it be > driven > through the "scope" parameter. Then later add the support for the > "resource" parameter and the specs above. > 2) Skip what I currently have and start something different based > on the > "resource" parameter specs. > > ATM I am more keen to option 1, so that we can have some audience > support in master ASAP. Also because the specs is still draft and I > don't know how much we can rely on the "resource" parameter being > adopted by 3rd party applications (for example Openshift). When we > later > have the option to drive audiences through both "scope" and > "resource" > params, it will be good thing IMO. > > The "resource" related support will require changes on the adapter > side > as it is new parameter to be supported in code-to-token request and > refresh-token request. On our adapter's side, it will be good to have > some changes to allow "cache" of more access tokens for various > resources/audiences, not just one. On server-side, I was thinking > about > various possibilities, and it still looks good to represent > "resource" > support through client scopes. So optional clientScopes can be > requested > either through "scope" parameter (default case) or through "resource" > parameter (probably disabled by default) or through both. > > Thoughts? > > > [1] https://github.com/mposolda/keycloak/tree/audience > [2] > https://tools.ietf.org/html/draft-ietf-oauth-resource-indicators-00 > > Marek > > _______________________________________________ > keycloak-dev mailing list > keycloak-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/keycloak-dev > From psilva at redhat.com Mon Sep 10 07:56:44 2018 From: psilva at redhat.com (Pedro Igor Silva) Date: Mon, 10 Sep 2018 08:56:44 -0300 Subject: [keycloak-dev] Audience support In-Reply-To: <2deecc7b-f8b1-c2c0-a958-abc3bd2eed43@redhat.com> References: <2deecc7b-f8b1-c2c0-a958-abc3bd2eed43@redhat.com> Message-ID: Hi Marek, I think "resource" will be a good addition but we are already capable of choosing/processing audiences using scopes. So yeah, IMO, we can go for #1. On Thu, Sep 6, 2018 at 5:28 PM, Marek Posolda wrote: > Hi, > > I have some concerns about the audience support. The prototype done few > months ago, which I have in my branch [1] is based on client scopes. I > showed it on the weekly demo some time ago and changed few things based > on the feedback. Just to clarify, the PR: > - Adds the AudienceProtocolMapper, which is able to attach single > client_id of the specified client (typically will be bearer-only client) > > - Adds the easy way to generate "audience client scope" for specified > "service" client (usually bearer-only client). This clientScope contains: > -- the audienceProtocolMapper of bearer-only described above > -- the scope role mappings of all the client roles of that bearer-only > client. > The "frontend" clients can then use this clientScope, so that audience + > roleMappings will be both available in the accessToken issued for the > frontend-client. > > Now there is this specs [2], which Pedro pointed. Short summary about > this specs: > > - It is still in draft state for few years and there are some TODO in > it. So hard to say how much to rely on it... > > - It specifically talks about "scope" parameter and mentions, that it is > often used by various parties for "what the token can be used for" > (permissions/claims associated with the token) and "where to use that > token" . But it mentions that "where" use-case should be ideally handled > by something else. > > - It introduces "resource" parameter, which MUST be an absolute URI per > this specification and it should point to the service/resource where the > access token will be used. When authorization server is creating token, > it may apply audiences, encrypt token by various algorithms based on the > requested "resource" etc. For the audience, they specify that: > > "The authorization server may use the exact 'resource' value as the > audience or it may map from that value to a more general URI or abstract > identifier for the resource server." > > - The "resource" parameter is used in the token request if possible. For > the grants where it's not possible (implicit, resource owner password > login, client credentials) it is used in the initial authentication > request. So for the classic "authorization_code" grant it can be used in > code-to-token or refresh-token requests. This is great and allows some > cool flexibility (unlike "scope" where the whole SSO login including all > the redirects is needed). But it requires some support on adapters. > > > Now I am thinking about 2 possible ways to continue: > > 1) Finish my current work around audience and for now, let it be driven > through the "scope" parameter. Then later add the support for the > "resource" parameter and the specs above. > 2) Skip what I currently have and start something different based on the > "resource" parameter specs. > > ATM I am more keen to option 1, so that we can have some audience > support in master ASAP. Also because the specs is still draft and I > don't know how much we can rely on the "resource" parameter being > adopted by 3rd party applications (for example Openshift). When we later > have the option to drive audiences through both "scope" and "resource" > params, it will be good thing IMO. > > The "resource" related support will require changes on the adapter side > as it is new parameter to be supported in code-to-token request and > refresh-token request. On our adapter's side, it will be good to have > some changes to allow "cache" of more access tokens for various > resources/audiences, not just one. On server-side, I was thinking about > various possibilities, and it still looks good to represent "resource" > support through client scopes. So optional clientScopes can be requested > either through "scope" parameter (default case) or through "resource" > parameter (probably disabled by default) or through both. > > Thoughts? > > > [1] https://github.com/mposolda/keycloak/tree/audience > [2] https://tools.ietf.org/html/draft-ietf-oauth-resource-indicators-00 > > Marek > > _______________________________________________ > keycloak-dev mailing list > keycloak-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/keycloak-dev > From Chris.Phillips at canarie.ca Mon Sep 10 10:55:40 2018 From: Chris.Phillips at canarie.ca (Chris Phillips) Date: Mon, 10 Sep 2018 14:55:40 +0000 Subject: [keycloak-dev] Can KeyCloak support Multi-lateral SAML federation? Message-ID: Hi. I sent this to the Users list and have had zero response. Re-sending here on the dev list hoping to hear feedback and thoughts from Keycloak Devs on my questions around KeyCloak's ability to support multi-lateral federation and if it is on the roadmap. Thanks and look forward to thoughts and comments.. Chris. ?On 2018-08-30, 4:06 PM, "keycloak-user-bounces at lists.jboss.org on behalf of Chris Phillips" wrote: Hi. I?m going through assessing KeyCloak as being able to be an Identity Provider in a multi-lateral SAML federation context and am seeking insight from the users and devs involved in KeyCloak. For an IdP to be considered interoperable in a multi-lateral SAML trust federation context, IdPs need to be able to do a base set of functions. These are some of the critical (but not only) ones: * Retrieve, with a configurable frequency (usually hourly), an online metadata aggregate * validate the signature on the aggregate * when signature validity is verified, load all the entities (Identity Providers/Service Providers) to be trusted or used in trust decisions in the Identity Provider. I have not seen this capability in KeyCloak 4.3.0.Final (docker) but could be missing something. Is anyone using KeyCloak in this manner or are there plans for this functionality on KeyCloak?s technical roadmap? Some additional items to decorate my ask for information.. To give an idea of scale, the aggregates I want to work with have ~4500 entities with 2800 IdPs and 2100 SPs and need to be refreshed hourly. The list of items important for interoperability can be seen here with the ones I called out above appearing in section 2.2.1: https://kantarainitiative.github.io/SAMLprofiles/fedinterop.html I?ve searched the keycloak-users list a bit and came across the reference to EntitiesDescriptor which lead me to this issue and code update in KeyCloak: https://issues.jboss.org/browse/KEYCLOAK-4399 which leads me to think that the support for reading in aggregates is not possible and maybe engineered out of the product itself. Am I right in thinking that? Thoughts and insights welcome.. Chris. ___________________________________________________________________________________________ Chris Phillips Technical Architect, Canadian Access Federation, CANARIE| chris.phillips at canarie.ca |GPG: 0x7F6245580380811D _______________________________________________ keycloak-user mailing list keycloak-user at lists.jboss.org https://lists.jboss.org/mailman/listinfo/keycloak-user From ssilvert at redhat.com Mon Sep 10 19:05:26 2018 From: ssilvert at redhat.com (Stan Silvert) Date: Mon, 10 Sep 2018 19:05:26 -0400 Subject: [keycloak-dev] Avoiding XSS in Keycloak/Freemarker Message-ID: *Executive summary: *Any time you use ?no_esc, make sure you also use kcSanitize(). Most of you on the team are already aware of this, but for completeness I'll post to the community dev list. Some time ago, we switched our default Freemarker settings so that everything is escaped by default.? However, this means that some things need to be explicitly "un-escaped".? This includes any time we allow HTML in an admin console field or in a resource bundle (*.properties file). The way this is done in Freemarker is to use the ?no_esc directive.? For example, login.ftl has This is fine, but what if, somehow an attacker was able to insert some HTML into message.summary?? It's unlikely because it requires a high level of access.? But it's possible. We now protect against this using a sanitizer for unescaped content.? From now on, you should call the Keycloak sanitizer any time you are using ?no_esc.? The sanitizer removes unsafe HTML using an algorithm similar to the one used on eBay.? So this example becomes: From it.vidhyadharan at gmail.com Tue Sep 11 04:07:14 2018 From: it.vidhyadharan at gmail.com (vidhyadharan D) Date: Tue, 11 Sep 2018 13:37:14 +0530 Subject: [keycloak-dev] Regarding https://issues.jboss.org/browse/KEYCLOAK-8162 In-Reply-To: References: Message-ID: The logo can be sent in the email like below On Mon, Sep 10, 2018 at 12:46 PM Stian Thorgersen wrote: > For emails shouldn't images actually be encoded into the email itself > rather than linked to? > > On Sun, 9 Sep 2018 at 19:18, vidhyadharan D > wrote: > >> Hi Experts, >> >> I have been working on keycloak html email. I am in need to embed logo >> to >> the emails i.e. from the *themes/email/resources/img/logo.png * >> >> In the login module there is a way to locate image / favicon via >> ${url.resourcesPath} >> >> However in email module we dont have access to locate the resources.. >> >> I have achieved by adding custom email template provider. If possible >> please add these into email module because it is useful for all . >> >> or let me know i can provide PR. >> >> https://issues.jboss.org/browse/KEYCLOAK-8162 >> >> >> Thanks, >> vidhya >> _______________________________________________ >> keycloak-dev mailing list >> keycloak-dev at lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/keycloak-dev >> > From it.vidhyadharan at gmail.com Tue Sep 11 04:08:36 2018 From: it.vidhyadharan at gmail.com (vidhyadharan D) Date: Tue, 11 Sep 2018 13:38:36 +0530 Subject: [keycloak-dev] Regarding https://issues.jboss.org/browse/KEYCLOAK-8162 In-Reply-To: References: Message-ID: On Tue, Sep 11, 2018 at 1:37 PM vidhyadharan D wrote: > The logo can be sent in the email like below > > > > > On Mon, Sep 10, 2018 at 12:46 PM Stian Thorgersen > wrote: > >> For emails shouldn't images actually be encoded into the email itself >> rather than linked to? >> >> On Sun, 9 Sep 2018 at 19:18, vidhyadharan D >> wrote: >> >>> Hi Experts, >>> >>> I have been working on keycloak html email. I am in need to embed logo >>> to >>> the emails i.e. from the *themes/email/resources/img/logo.png * >>> >>> In the login module there is a way to locate image / favicon via >>> ${url.resourcesPath} >>> >>> However in email module we dont have access to locate the resources.. >>> >>> I have achieved by adding custom email template provider. If possible >>> please add these into email module because it is useful for all . >>> >>> or let me know i can provide PR. >>> >>> https://issues.jboss.org/browse/KEYCLOAK-8162 >>> >>> >>> Thanks, >>> vidhya >>> _______________________________________________ >>> keycloak-dev mailing list >>> keycloak-dev at lists.jboss.org >>> https://lists.jboss.org/mailman/listinfo/keycloak-dev >>> >> From sthorger at redhat.com Tue Sep 11 09:08:40 2018 From: sthorger at redhat.com (Stian Thorgersen) Date: Tue, 11 Sep 2018 15:08:40 +0200 Subject: [keycloak-dev] Regarding https://issues.jboss.org/browse/KEYCLOAK-8162 In-Reply-To: References: Message-ID: I was thinking inline base64 images. I don't have an issue with a PR to make the resourceUrl available to emails, do you need it in the template or the properties? Having it in the properties is a lot messier. On Tue, 11 Sep 2018 at 10:08, vidhyadharan D wrote: > > > > On Tue, Sep 11, 2018 at 1:37 PM vidhyadharan D > wrote: > >> The logo can be sent in the email like below >> >> >> >> >> On Mon, Sep 10, 2018 at 12:46 PM Stian Thorgersen >> wrote: >> >>> For emails shouldn't images actually be encoded into the email itself >>> rather than linked to? >>> >>> On Sun, 9 Sep 2018 at 19:18, vidhyadharan D >>> wrote: >>> >>>> Hi Experts, >>>> >>>> I have been working on keycloak html email. I am in need to embed >>>> logo to >>>> the emails i.e. from the *themes/email/resources/img/logo.png * >>>> >>>> In the login module there is a way to locate image / favicon via >>>> ${url.resourcesPath} >>>> >>>> However in email module we dont have access to locate the resources.. >>>> >>>> I have achieved by adding custom email template provider. If possible >>>> please add these into email module because it is useful for all . >>>> >>>> or let me know i can provide PR. >>>> >>>> https://issues.jboss.org/browse/KEYCLOAK-8162 >>>> >>>> >>>> Thanks, >>>> vidhya >>>> _______________________________________________ >>>> keycloak-dev mailing list >>>> keycloak-dev at lists.jboss.org >>>> https://lists.jboss.org/mailman/listinfo/keycloak-dev >>>> >>> From ruria at zzircon.com Tue Sep 11 10:43:59 2018 From: ruria at zzircon.com (=?UTF-8?B?UmHDumwgVXLDrWEgRWxpY2Vz?=) Date: Tue, 11 Sep 2018 16:43:59 +0200 Subject: [keycloak-dev] Proxy injects Role headers Message-ID: Hi all, We would like proxy to inject Role information as a header for authorization purpouses. I think this can be easily achive by adding a new key for "header-names" in config.json and putting the information that already exists on the back request ... We have a working branch for this, maybe we can pull request if is interesting for others. bye. -- ? ? *Ra?l Ur?a El?ces* Director ? e-mail: ruria at zzircon.com web:???? www.zzircon.com Tlf:??????? 609 721021 ? ZZircon Technologies SL Parque Cient?fico Tecnol?gico de Cantabria Edificio 3000 Oficina 11 c/ Isabel Torres 11 39011 Santander ? ? /Este mensaje de correo electr?nico y sus documentos adjuntos est?n dirigidos EXCLUSIVAMENTE a los destinatarios especificados. La informaci?n contenida puede ser CONFIDENCIAL y / o estar LEGALMENTE PROTEGIDA y no necesariamente refleja la opini?n de este grupo de correo. Si usted recibe este mensaje por ERROR, por favor comun?queselo inmediatamente al remitente y elim?nelo ya que usted NO ESTA AUTORIZADO al uso, revelaci?n, distribuci?n, impresi?n o copia de toda o alguna parte de la informaci?n contenida. Gracias./ ? ZZircon Technologies SL- TFNO 609 721021 ??? info at zzircon.com ? ? ? ? ? -------------- next part -------------- -------------- next part -------------- A non-text attachment was scrubbed... Name: jgghhgnpkcpoojee.jpg Type: image/jpeg Size: 4300 bytes Desc: not available Url : http://lists.jboss.org/pipermail/keycloak-dev/attachments/20180911/8d25719b/attachment.jpg From slaskawi at redhat.com Wed Sep 12 04:00:05 2018 From: slaskawi at redhat.com (Sebastian Laskawiec) Date: Wed, 12 Sep 2018 10:00:05 +0200 Subject: [keycloak-dev] Clustering configuration Message-ID: Hey guys, During our weekly sync meeting, Stian asked me to look into different options for clustering in Keycloak server. This topic has quite hot with the context of our Docker image (see the proposed community contributions [1][2][3]). Since we are based on WF 13, which uses JGroups 4.0.11 and has KUBE_PING in its modules, we have a couple of options how to do it. Before discussing different implementations, let me quickly go through the requirements: - We need a configuration stack that works for on-prem and cloud deployments with OpenShift as our primary target. - The configuration should be automatic (if it's possible). E.g. if we discover that Keycloak is running in the container, we should use proper discovery protocol. - There needs to be a way to override the discovery protocol manually. With those requirements in mind, we have a couple of implementation options on the table: 1. Add more stacks to the configuration, e.g. openshift, azure or gcp. Then we use the standard `-Djboss.default.jgroups.stack=` configuration switch. 2. Provide more standalone-*.xml configuration files, e.g. standalone-ha.xml (for on-prem) or standalone-cloud.xml. 3. Add protocols dynamically using CLI. A similar approach to what we did for the Data Grid Cache Service [4]. 4. Use MULTI_PING protocols [5][6], with multiple discovery protocols on the same stack. This will include MPING (for multicasting), KUBE_PING (if we can access Kubernetes API), DNS_PING (if Pods are governed by a Service). Option #1 and #2 is somewhat similar to what we did for Infinispan [7]. It works quite well but the configuration grows quite quickly and most of the protocols (apart from discovery) are duplicated. On the other hand, having separate configuration pieces for each use case is very flexible. Having in mind that AWS cuts TCP connections, using FD_SOCK might lead to false suspicions but on GCP for the instance, FD_SOCK works quite nicely. The CLI option (#3), is also very flexible and probably should be implemented only in our Docker image. This somehow follows the convention we already started with different CLI files for different DBs [8]. Option #4 is brand new (implemented in JGroups 4.0.8; we have 4.0.11 as you probably recall). It has been specifically designed for this kind of use cases where we want to gather discovery data from multiple places. Using this way, we should end up with two stacks in standalone-ha.xml file - UDP and TCP. I honestly need to say, that my heart goes for options #4. However, as far as I know it hasn't been battle tested and we might get some surprises. All other options are not as elegant as option #4 but they are used somewhere in other projects. They are much safer options but they will add some maintenance burden on our shoulders. What would you suggest guys? What do you think about all this? @Rado, @Paul, @Tristan - Do you have any plans regarding this piece in Wildfly or Infinispan? Thanks, Sebastian [1] https://github.com/jboss-dockerfiles/keycloak/pull/96 [2] https://github.com/jboss-dockerfiles/keycloak/pull/100 [3] https://github.com/jboss-dockerfiles/keycloak/pull/116 [4] https://github.com/jboss-container-images/datagrid-7-image/blob/datagrid-services-dev/modules/os-datagrid-online-services-configuration/src/main/bash/profiles/caching-service.cli#L37 [5] http://www.jgroups.org/manual4/index.html#_multi_ping [6] https://issues.jboss.org/browse/JGRP-2224 [7] https://github.com/infinispan/infinispan/tree/master/server/integration/jgroups/src/main/resources/subsystem-templates [8] https://github.com/jboss-dockerfiles/keycloak/tree/master/server/tools/cli/databases From it.vidhyadharan at gmail.com Wed Sep 12 04:30:37 2018 From: it.vidhyadharan at gmail.com (vidhyadharan D) Date: Wed, 12 Sep 2018 14:00:37 +0530 Subject: [keycloak-dev] Regarding https://issues.jboss.org/browse/KEYCLOAK-8162 In-Reply-To: References: Message-ID: suppose if i move the themes from development to production, in that case i need to update the properties each time . where as in template variable it is automatically calculated. inline base64 images will suit for web emails, but for outlook it is not supported , however logo svg will apt for all email clients. by implementing the *${hostname}/${url.**resourcesPath}* *Custom fonts* also served from *themes location*.