Switching Keycloak Realm based on subdomain - keycloak

We are using Keycloak as our authentication server behind an application server. The solution is multi-tenanted by the subdomain. We need to switch the realm automatically based on the subdomain.
Example when user visits,
abc.xyz.com/auth/ -> abc realm.
bcd.xyz.com/auth -> bcd realm.
This will allow us to unify the auth logic on all the other applications on the domain. any leads? We do have the capability of setting the realm as a header using our proxy.
cheers,
Thanks in advance,
Kaveen Rodigo

There was no clear and out-of the box solution for this. Instead what I opted was to use was the Landing Page (React APP) to take a look at the subdomain and re-write the realm accordingly.

Related

Capture IDP User attributes in SAP cloud foundry app via SDK UserAccesor API

I wanted to capture user attributes coming from SAP IDP(Identity & Authentication tenant service like department,salutation ,company etc ,via UserAccessor SDK api,but although those attributes are set and has value in IDP user and all the integration with IDP and sub account is in place post authentication ,user attributes object is empty ,i am only able to retrieve specific attributes like first names ,last name,email address ,user groups etc via JWT and UserAccessor api ,but no luck with other attributes ,in IDP i have mentioned these attributes as well under assertion attributes in SAP Identity authentication tenant .
Please guide and help in this matter .
Thanks Siddharth
Update: As we have now identified the problem, I will update my answer to reflect that. The original answer below is outdated:
Okay so the problem is that you haven't mapped any additional user attributes from your Identity Provider (IdP) to your JWT. As far as I'm aware there are three things you will need to do:
You need to create attributes in your xs-security.json (the file you used to configure your XSUAA service instance). This documentation should explain how to do that.
You need to configure which attributes are exposed by your IdP (in your case the SAP Identity & Authentication service. This documentation looks like a good place to start looking).
You need to map the attributes exposed by your IdP to the attributes defined in your xs-security.json. You will probably need to reconfigure (i.e. delete, recreate and rebind) your XSUAA service instance with the updated config, before you can do this step. Then, navigate to your application in the Cloud Platform Cockpit, from the left toolbar click "Security > Roles" and create your mapping.
Let me know if this works for you!
Original Answer:
As far as I'm aware the default IdP does not support SAML. Without SAML, I'm not sure whether you can propagate any attributes from your IdP into the JWT.
Please also check out this discussion for more information.

Using OpenID Connect to share data

I am an OpenID neophyte, so please correct me if I'm using the wrong terminology, but here's the problem I'm trying to solve:
I have a web site, let's call it "LB" which has a database. I've also created my own OpenID Connect identity server "IDS", and configured LB to use it for logging in. IDS doesn't have its own database, it's using LB's database.
Now, I want to introduce a CMS (like WordPress or Umbraco or whatever) into the mix. I want the CMS to use IDS, so that a single sign-on can be shared between LB and CMS. That seems relatively straightforward to do with a plugin like this one.
So now, suppose there is some bit of data in LB that I want to integrate with the CMS. Maybe while on the CMS site, the user can go to a profile page or something, and I want to show some interesting bits from LB on that profile page. Could be something dynamic that is affected by the user's activity in LB, maybe a HTML snippet, an image, or just some raw JSON to put into a template. Is the UserInfo endpoint what I should be using for this? (E.g. CMS asks IDS for the info) Or should CMS talk directly to LB somehow (and if so, how)?
The question is a bit abstract so I may be off, but if you want to return an arbitrary data, then it probably is better to create a new endpoint representing that "protected resource" such as https://LB.example.com/activities. You get an access token with OpenID Connect login, so you can use that to access this oauth protected resource.

liferay authentication from soap

I need integrate Liferay (version 6.2) with another service which stores information about users. Communication with service occurs through SOAP.
Is it possible use users from service to authenticate to Liferay?
Liferay integrates with external systems through LDAP already. If you use that interface, you're set. If you need a proprietary API to access user information, you will have some work in front of you.
It might be worth examining the SSO implementation and intercept newly authenticated users on this level: With the user's identity, create or update a Liferay user account on the fly through LIferay's API. To me this looks like the most promising approach from an effort/maintenance point of view, with the little information I have about your situation.
Alternatively you could batch-update all (Liferay-) user accounts from time to time, based on updates in your external system.
Let me see if I understand what need:
1- Step 1: User prompted with A login page.
2- Step 2: The credentials entered by the user are checked against a web service (could be any service)
3- Step 3: The user is either logged in or an auth error displayed to the user.
If that's what you need, then create an autologin hook. The code that call the webs service shall live in the autologin hook.
May seem intimidating, but it is trivial: likely liferay comes with a bunch of them: (take one of them as a template)
auto.login.hooks=com.liferay.portal.security.auth.CASAutoLogin,com.liferay.portal.security.auth.FacebookAutoLogin,com.liferay.portal.security.auth.NtlmAutoLogin,com.liferay.portal.security.auth.OpenIdAutoLogin,com.liferay.portal.security.auth.OpenSSOAutoLogin,com.liferay.portal.security.auth.RememberMeAutoLogin,com.liferay.portal.security.auth.SiteMinderAutoLogin

SSO with persona multiple sites

anybody know is possible to use Persona for SSO purposes for cross site login, where each site is it's own domain? Very similar to 37signals and how they set up basecamp, Highrise and campfire.
Would like to have user create something similar to a 37 signals ID.
thanks.
If all of your sites share a common domain (e.g. foo.example.com and bar.example.com) then you could have a login server (say login.example.com) that sets an example.com-wide cookie that each subdomain can use.
For cross-domain sites, there has been a realm proposal but it's not currently being worked on.

Adobe CQ5: SSO without LDAP?

A customer of ours has just purchased CQ5 and would like to externalize all of its security. We'd like to use an STS server for SSO and then leverage a custom authorization/attribute provider instead of the CQ5 repository. Ultimately, we do not want to use LDAP in any way.
Here is how we envision this (some pieces already working):
User browses to CQ5 Dispatcher running in Apache
Apache filter redirects user to STS site where login is completed.
User is redirected back to Apache with SAML Claims.
User ID token is placed as cookie into browser. (everything is working up to here)
CQ5 captures that cookie based on the SSO configuration (working)
Problem starts here: From here, we want to call a custom authorization provider for the user's attributes, roles, groups etc...
We have tried to figure out how to do this and can't seem to find the missing link.
Do we need to create a custom login module? Do we need to create a custom principal provider? Do we somehow use the existing LDAP capability in CQ5 but have it call a custom class which leverages the external auth source?
If anyone here has any idea how to do this, their karma quotient would be full for the year if they could share it. I'm not sure if this is a basic thing you do with JAAS or even where to put my classes after I've created them.
We've worked really hard on this so far and seem to be close, but we keep hitting dead-ends.
Thanks so much if you have an idea where to begin!!
-joe
Recent versions of AEM now include the SAMLAuthenticationHandler which allows you to:
Redirect users to SSO to simulate IDP initiated login, or
Allow AEM to perform SP initiated login with IDP
Specify attributes to take from the SAML Assertion and add to the user's profile node (not sure if you can use this for groups)
Specify which groups users should be added to
Set a cookie called request-path that will store the URL the user arrived at, and then redirect them to that location when they're authenticated (ie. deep linking)
This makes relying on the SAMLAuthenticationHandler better than using Apache to redirect. The current version of the handler bundled with AEM 6.2 does not properly set the cookie when using the redirect method, but Adobe does have an updated version that they can provide that will fix that problem.
I normally recommend that clients do not have their own authentication handlers developed inside AEM.
When not using LDAP, this does create an issue where users will not exist until they've logged in. Additionally, when your architecture includes more than one load balanced publisher, it is possible that a user may exist on one server user synchronization.
Try searching the google group for SSO details. Here's one useful post:
http://groups.google.com/group/day-communique/browse_thread/thread/72c235c83a501252/fba4d08a90487156?lnk=gst&q=SSO#fba4d08a90487156
It seems that you will have to implement a custom LoginModule, more information here: http://dev.day.com/docs/en/crx/current/deploying/custom-login-modules.html