Tuesday, November 17, 2015
ssoadm CLI - when to encrypt password?
This summary is not available. Please
click here to view the post.
Monday, November 16, 2015
ssoadm CLI - Directory Configuration Part II
So there is, in fact, a way to script the Directory Configuration as mentioned by Peter.
$ ./ssoadm get-svrcfg-xml -u amadmin -f .pwd.txt -s http://am0-test.XXXX.net:8080/auth
$ ./ssoadm set-svrcfg-xml -u amadmin -f .pwd.txt -s http://am0-test.XXXX.net:8080/auth -X /data/bin//am-config/dir-conf.xml
Do take note to:
1. only update the SMS Server Group.
2. encrypt password via ampassword CLI
.
The easiest way is to export the configuration in XML format, then import again via the ssoadm CLI.
$ ./ssoadm get-svrcfg-xml -u amadmin -f .pwd.txt -s http://am0-test.XXXX.net:8080/auth
$ ./ssoadm set-svrcfg-xml -u amadmin -f .pwd.txt -s http://am0-test.XXXX.net:8080/auth -X /data/bin//am-config/dir-conf.xml
Do take note to:
1. only update the SMS Server Group.
2. encrypt password via ampassword CLI
.
Friday, November 13, 2015
ssoadm CLI - Directory Configuration
Using ssoadm CLI to list a server configuration, I found out that the Directory Configuration information is not returned.
If you reference the OpenAM documentation, you would also realize there is no property listed in Servers > Directory Configuration section.
1) Now, for best practice, we would definitely not want to use cn=Directory Manager to bind to OpenDJ. A better approach is to create a service account.
2) In production, especially when a pair of external OpenDJ is deployed, we would want to add Server2 to point to the 2nd external OpenDJ.
For (1), this can be easily solved by:
a. Create the service account prior to installation & configuration of OpenAM
b. In the OpenAM configuration file,
DATA_STORE=dirServer
DIRECTORY_SSL=SIMPLE
:
DS_DIRMGRDN=cn=Directory Manager
DS_DIRMGRPASSWD=password
Change DS_DIRMGRDN and DS_DIRMGRPASSWD to the service account.
For (2), I have no idea how to script this. For now, I would have to manually add in via OpenAM Administration console.
Technically, I know this Directory Configuration is stored as XML in one of the LDAP attributes. Is this the challenge in not able to add/retrieve the information? I do not know.
Less than ideal.
Wednesday, November 11, 2015
ssoadm CLI for scaling and de-scaling of OpenAM nodes
This summary is not available. Please
click here to view the post.
Saturday, October 24, 2015
OpenAM : How to exchange for a long-lived access token from Facebook?
I have a customer who has a big data marketing engine running and they request for more information from Facebook to gather insights into their customers.
By default, when a user authenticates with Facebook via OpenAM Login Page, only a short-lived access token is captured.
There are 2 issues:
I did some research and this is what is required to exchange a short-lived access token with a long-lived access token.
You must exchange this short lived token with a long lived token by invoking a GET request to the following URL:
https://graph.facebook.com/v2.0/oauth/access_token?grant_type=fb_exchange_token&client_id=[APP_ID]&client_secret=[APP_SECRET]&fb_exchange_token=[SHORT_LIVED_TOKEN]
Where:
APP_ID is your application id.
APP_SECRET is your application secret.
SHORT_LIVED_TOKEN is the short lived user access token received in the previous step.
What comes back:
The JSON response will contain the long lived access token.
To achieve customer's requirement, we can write some custom codes in Post-Authentication Processing module.
@Override
public void onLoginSuccess( Map requestParamsMap, HttpServletRequest request,
HttpServletResponse response, SSOToken ssoToken )
throws AuthenticationException {
if (authentication module is Facebook) {
// THIS IS KEY! Without it, there is no way to exchange for a long-lived
// access token
// this is short-lived access token returned from Facebook at OAuth
// authentication module
String accessToken = ssoToken.getProperty
(OAuthParam.SESSION_OAUTH_TOKEN);
// clientId, clientSecret, tokenServiceUrl
// quick and dirty is to hardcode;
// otherwise, read OAuth.java, OAuthParam.java and OAuthConf.java
// Need to strip:
// e.g. access_token=[LONG-LIVED-ACCESS-TOKEN]&expires=5148647
longLivedToken = longLivedToken.substring(13,longLivedToken.indexOf("&"));
// Persist FB long-lived access token to user's LDAP entry
updateFBLongLivedAccessToken (longLivedToken, ssoToken);
}
}
Nice!
By default, when a user authenticates with Facebook via OpenAM Login Page, only a short-lived access token is captured.
There are 2 issues:
- The marketing engine will only run nightly/weekly. The short-lived access token would have expired then.
- The access token, even if it has not expired, is not persisted. Thus the marketing engine has no means to pick it up.
I did some research and this is what is required to exchange a short-lived access token with a long-lived access token.
You must exchange this short lived token with a long lived token by invoking a GET request to the following URL:
https://graph.facebook.com/v2.0/oauth/access_token?grant_type=fb_exchange_token&client_id=[APP_ID]&client_secret=[APP_SECRET]&fb_exchange_token=[SHORT_LIVED_TOKEN]
public void onLoginSuccess( Map requestParamsMap, HttpServletRequest request,
HttpServletResponse response, SSOToken ssoToken )
throws AuthenticationException {
if (authentication module is Facebook) {
// THIS IS KEY! Without it, there is no way to exchange for a long-lived
// access token
// this is short-lived access token returned from Facebook at OAuth
// authentication module
String accessToken = ssoToken.getProperty
(OAuthParam.SESSION_OAUTH_TOKEN);
// clientId, clientSecret, tokenServiceUrl
// quick and dirty is to hardcode;
// otherwise, read OAuth.java, OAuthParam.java and OAuthConf.java
String clientId = ...;
String clientSecret = ...;
String tokenServiceUrl = ...;
// follow the URL format above (highlighted in blue)
String url = getFormattedTokenServiceUrlForFBLongLivedToken
(accessToken, clientId, clientSecret, tokenServiceUrl);
(accessToken, clientId, clientSecret, tokenServiceUrl);
// make a GET call to Facebook to exchange for a long-lived access token
// methods getContent() and getContentStreamByGET() available
// in OAuth.java (no need to reinvent wheel; modify a bit will do)
// in OAuth.java (no need to reinvent wheel; modify a bit will do)
String longLivedToken = getContent(url);
// Need to strip:
// e.g. access_token=[LONG-LIVED-ACCESS-TOKEN]&expires=5148647
longLivedToken = longLivedToken.substring(13,longLivedToken.indexOf("&"));
// Persist FB long-lived access token to user's LDAP entry
updateFBLongLivedAccessToken (longLivedToken, ssoToken);
}
}
Tuesday, October 20, 2015
OpenAM 12 - Social Authentication
In OpenAM 12, one of the new features released was Social Authentication made-easy.
Social Authentication
Log in to an OpenAM protected resource by using your existing social website credentials. OpenAM supports Facebook, Google, Microsoft, or any other OpenID Connect 1.0 compliant identity provider.
OpenAM administrator can easily configure Social Authentication via the Common Tasks tab.
And the respectively Social Login logos will auto-magically appear on the default OpenAM Login Page, without any customization. Wow!
Yes, it did wow-ed one of my customers when some pre-sales presented this feature during selling/POC.
Side note: You'll be quite amazed the decision makers here are easily wow-ed by UI experience, rather than comparing products technically. (Few years ago, I did mentioned about the hard selling of OpenIDM without a proper UI. These days, it's much easier to sell with the launch of UI in OpenIDM 3.x.)
Back to our original topic, what's the catch?
Read again:
Social Authentication
Log in to an OpenAM protected resource by using your existing social website credentials. OpenAM supports Facebook, Google, Microsoft, or any other OpenID Connect 1.0 compliant identity provider.
So during project implementation, this particular customer wants to have LinkedIn "auto-magically" appear on the Login Page as this was what he requested then.
Technically, to configure via the "short-cut" in Common Tasks tab is impossible. That's what I have to admit to Mr Customer. This is because LinkedIn does not currently supports OpenID Connect.
There is, however, workaround which I have researched for him and made it work for him.
OpenAM is very flexible to tweak around. But of course, some investment in time are required.
.
Thursday, October 15, 2015
OpenAM XUI Policy Editor ... on Safari
I was developing a custom policy condition for a customer. In the process, I was constantly clearing/disabling browser cache and was playing with XUI Policy Editor a lot.
I'm seldom on Safari even though I'm using a Mac. But because of my laziness to keep clearing cache, I used Safari in one of my testings. That's when I found something weird in Safari.
The last line "policy.subjectType.Policy.title" in Subject Conditions is always showing in Safari.
The last line "policy.conditionTypes.Policy.title" in Environment Conditions is always showing in Safari.
So I went ahead to install a default OpenAM without any customisation. The same behaviour exists in Safari.
Kind of strange... maybe I'll spend some time searching OpenAM bugster to see if this issue has been raised before.
.
Tuesday, October 13, 2015
OpenAM XUI Policy Editor ... Inconsistent UI
Having played with XUI for the OpenAM Policy Editor for a while (coming to 2 months), I must say I do not yet have a positive experience with it.
For example, there is this piece of inconsistency in the OpenAM Policy Editor implementation.
To add a resource, it's fairly simple.
Where is the "+" to add?
Now, to remove a subject condition, one has to click on the "rubbish bin" icon, instead of "X" which was used in Resources.
Both "rubbish bin" and "X" serve the same function perfectly. However, in a product (especially within the same Policy Editor), one would expect the UI experience to be consistent throughout.
Kind of weird to me.
If I were to implement such a UI, I would have failed my Human-Computer Interaction course badly many years back in the University. I had a strict lecturer then. :)
.
For example, there is this piece of inconsistency in the OpenAM Policy Editor implementation.
To add a resource, it's fairly simple.
Step 1: Roll over the mouse on "Available patterns". A green arrow appears. Click on the arrow.
Step 2: On the right-hand side, a "+" appears. Click on it and it will add the pattern to the resource. Simple!
If you want to remove the pattern, a "X" is available to carry out the function. Intuitive.
Now, the UI experience for Define Subject Conditions and Define Environment Conditions is not consistent with the previous experience.
For example, to add a subject type, one has to drag the grey bar to the green area. (I missed this totally when I first used this XUI policy editor)
Where is the "+" to add?
Now, to remove a subject condition, one has to click on the "rubbish bin" icon, instead of "X" which was used in Resources.
Both "rubbish bin" and "X" serve the same function perfectly. However, in a product (especially within the same Policy Editor), one would expect the UI experience to be consistent throughout.
Kind of weird to me.
If I were to implement such a UI, I would have failed my Human-Computer Interaction course badly many years back in the University. I had a strict lecturer then. :)
.
Tuesday, September 29, 2015
Configuration store servers are not listed in Directory Configuration
I was working on an Open Identity Stack (OpenAM, OpenDJ, OpenIDM) project and OpenAM 12.0.1 was installed.
When verifying my configuration, I hit into OPENAM-6499 - Configuration store servers are not listed in Directory Configuration.
So, this was caused by a recently introduced new feature - Object Deserialisation Class Whitelist. The workaround was mentioned in the bugster.
Now, customer wanted scripted installation and configuration, so I was using SSO Administration Tool as much as I could. So, I went ahead to add the 4 classes into the whitelist ... 1 at a time.
But as soon as I keyed in the 1st class and tried to navigate around OpenAM Console, I hit into Invalid URL error.
I fired up OpenDJ and realised the default list of classes that shipped with OpenAM 12.0.1 was gone. The ssoadm command override the old values! (Need to be careful next time)
Luckily I always have backups! So, the 4 classes had to be appended to the existing list of classes like the following.
So I realized $ sign had to be "escaped" ... aka prefixed with a backward slash.
After this, the configuration store servers finally shown up!
When verifying my configuration, I hit into OPENAM-6499 - Configuration store servers are not listed in Directory Configuration.
So, this was caused by a recently introduced new feature - Object Deserialisation Class Whitelist. The workaround was mentioned in the bugster.
Workaround is to add the following to the openam.deserialisation.classes.whitelist
Configuration -> Servers and Sites -> Default Server Settings -> Security -> Object Deserialisation Class Whitelist
com.sun.identity.common.configuration.ServerConfigXML com.sun.identity.common.configuration.ServerConfigXML$DirUserObject com.sun.identity.common.configuration.ServerConfigXML$ServerGroup com.sun.identity.common.configuration.ServerConfigXML$ServerObject
Now, customer wanted scripted installation and configuration, so I was using SSO Administration Tool as much as I could. So, I went ahead to add the 4 classes into the whitelist ... 1 at a time.
But as soon as I keyed in the 1st class and tried to navigate around OpenAM Console, I hit into Invalid URL error.
I fired up OpenDJ and realised the default list of classes that shipped with OpenAM 12.0.1 was gone. The ssoadm command override the old values! (Need to be careful next time)
Luckily I always have backups! So, the 4 classes had to be appended to the existing list of classes like the following.
But .... it became worse ... the whitelist is now empty!
After this, the configuration store servers finally shown up!
Tuesday, September 1, 2015
OpenAM Performance ... with APM solution
In all my deployment of OpenAM in Production, I will always tune the JVM as well as OpenAM tunable parameters before I hand-over the SSO infrastructure to customers.
From tuning perspective, I only have 1 product in mind ... i.e. this particular JVM is supposed to run OpenAM optimally. I will not cater for any other component(s) that might be deployed on the same JVM. Honestly, if I am not told beforehand, how do I know what to cater for and which parameters to tune?
These days, APM solutions are picking up. APM vendors preach that their solutions, when deployed on the same JVM where the production codes are running, have little footprint. And thus, it is alright to run APM alongside production codes.
Really? I just had a customer who reported a JVM heap of over 80% 5-6 times per month.
Their systems/middleware team deployed the APM diagnostic tool when the SSO system went LIVE as part of their go-LIVE procedure ... without thinking of any impact/side-effect.
After removing the diagnostic tool, there is no more report of heap size issue for almost a month.
Lesson learnt I hope.
.
From tuning perspective, I only have 1 product in mind ... i.e. this particular JVM is supposed to run OpenAM optimally. I will not cater for any other component(s) that might be deployed on the same JVM. Honestly, if I am not told beforehand, how do I know what to cater for and which parameters to tune?
These days, APM solutions are picking up. APM vendors preach that their solutions, when deployed on the same JVM where the production codes are running, have little footprint. And thus, it is alright to run APM alongside production codes.
Really? I just had a customer who reported a JVM heap of over 80% 5-6 times per month.
Their systems/middleware team deployed the APM diagnostic tool when the SSO system went LIVE as part of their go-LIVE procedure ... without thinking of any impact/side-effect.
After removing the diagnostic tool, there is no more report of heap size issue for almost a month.
Lesson learnt I hope.
.
Friday, August 21, 2015
Install OpenDJ Directory Server With a Properties File
We were working with some AWS engineers on creating puppet scripts for a Open Identity Stack installation.
OpenDJ installation with a properties file was what we tackled first since it is fairly easy to get OpenDJ up and running, with command line.
There is a section in ForgeRock Documentation that describes how to Install OpenDJ Directory Server With a Properties File.
A sample properties file was given, but it was unclear what is the use of ldifFile?
As I didn't know what was that ldifFile parameter for, I commented it during installation. All went fine and the installation was completed successfully. But ...
When we started to configure OpenAM, we encountered error - "Invalid Suffix".
OpenDJ installation with a properties file was what we tackled first since it is fairly easy to get OpenDJ up and running, with command line.
There is a section in ForgeRock Documentation that describes how to Install OpenDJ Directory Server With a Properties File.
A sample properties file was given, but it was unclear what is the use of ldifFile?
As I didn't know what was that ldifFile parameter for, I commented it during installation. All went fine and the installation was completed successfully. But ...
When we started to configure OpenAM, we encountered error - "Invalid Suffix".
So I fired up OpenDJ Control Panel to take a look, and I discovered why.
There was no entry at all.
Usually when I install OpenDJ via command line, I would be given an option to choose like the following:
And I usually choose Option 1. I needed an equivalent via the Properties File installation method.
The documentation was not clear enough what we should do in such a situation. So I played around with the ldifFile parameter. I should define a base entry in the ldif File. And that will do.
dn: dc=cdemo,dc=sg
dc: cdemo
objectClass: top
objectClass: domain
And that really solved the issue! A check with OpenDJ Control Panel showed everything was in place after the successful configuration of OpenAM.
Nice!
.
Thursday, August 20, 2015
OpenAM 12 Sessions
Peter has a nice blog (Sessions) regarding how sessions work in OpenAM, especially in release 12 onwards.
I was discussing with a customer few days ago regarding how to deploy OpenAM optimally on Amazon Web Services. One topic which we discussed in-depth was how does OpenAM session work and why do OpenAM nodes need to be aware of one another.
ForgeRock documentation has a lot of information regarding how the Core Token Service (CTS) works and how performance is optimised when Reduced Crosstalk is enabled.
Great stuff!
PS: Peter has started using diagrams in his blog! Keep it up! :)
.
I was discussing with a customer few days ago regarding how to deploy OpenAM optimally on Amazon Web Services. One topic which we discussed in-depth was how does OpenAM session work and why do OpenAM nodes need to be aware of one another.
ForgeRock documentation has a lot of information regarding how the Core Token Service (CTS) works and how performance is optimised when Reduced Crosstalk is enabled.
However, the documentation did not mention much about any activity besides sessions validation via cross-talk.
Our discussion that day was : "What is the other usage(s) of crosstalk? Can we remove crosstalk totally as we scale up/down frequently in AWS environment? If not, what happens when an OpenAM node is removed from site? Will crosstalk becomes the performance bottleneck in "non-locatable" OpenAM situation? "
Luckily, as what Peter has mentioned in his blog, Cluster State Service is here to help.
Monitoring servers
As we already know, under normal circumstances OpenAM uses crosstalk when requests gets misrouted, and this is something that does not change once session failover is enabled. Although the sessions are stored in OpenDJ, OpenAM will remain to send crosstalk requests to the other instances (in essence, this behavior is what the reduced crosstalk mode attempts to change).
In case of session failover it doesn’t really help if AM waits on crosstalk response from a node which may be actually unavailable. In order to prevent this scenario, there is a component that gets automatically enabled once session failover has been enabled: the ClusterStateService (or CSS as I’d like to call it). The ClusterStateService essentially tries to monitor the servers within the current site (and since 12 it also monitors remote site URLs), so that if there is a need to do a crosstalk, OpenAM first checks with ClusterStateService whether the given node is available, before sending any kind of crosstalk request.
Great stuff!
PS: Peter has started using diagrams in his blog! Keep it up! :)
.
Wednesday, August 19, 2015
OpenAM 12 : Changes & Deprecated Functionality
We kick-started an Open Identity Stack (OpenAM, OpenIdM, OpenDJ) project yesterday. * feeling excited *
So for this project, we intend to use OpenAM 12.0.1 - the latest release to 12 series.
In Additional New Features, I saw the following which my customers asked for:
Personally, since I'm very much into the internal working of OpenAM, my favourite will be:
In OpenAM 12, there are quite a number of important changes which we need to be aware of. Read Chapter 3. OpenAM Changes & Deprecated Functionality.
The Policy Evaluation engine has undergone huge changes, so one has to be careful here when performing an upgrade. Luckily this is a green field project!
There is also a lot of fixes - read 4.1. Key Fixes.
.
So for this project, we intend to use OpenAM 12.0.1 - the latest release to 12 series.
In Additional New Features, I saw the following which my customers asked for:
- Audit Logging to Syslog
- CORS Support for OpenAM APIs
- Session Failover Across Sites
- Whitelist for Custom Login URIs
- Policy Support for Common HTTP Operations
Personally, since I'm very much into the internal working of OpenAM, my favourite will be:
- Reduced Cross-Talk
In OpenAM 12, there are quite a number of important changes which we need to be aware of. Read Chapter 3. OpenAM Changes & Deprecated Functionality.
The Policy Evaluation engine has undergone huge changes, so one has to be careful here when performing an upgrade. Luckily this is a green field project!
There is also a lot of fixes - read 4.1. Key Fixes.
.
Thursday, August 13, 2015
Adaptive Risk Authentication
Adaptive Risk Authentication has been built into most SSO products these days. Should I say all? It used to be an add-on module or by-product, which customers have to pay extra. However, these days, we are seeing that this feature is shipped by default.
So, what makes a good authentication of choice? I found this slide from a CA webinar.
.
So, what makes a good authentication of choice? I found this slide from a CA webinar.
.
Subscribe to:
Posts (Atom)



































