Tagged: Remote authentication, REST API
This topic has 2 replies, 2 voices, and was last updated 5 years, 6 months ago by mat_sunil.
-
AuthorPosts
-
January 23, 2017 at 4:41 pm #15479
mat_sunil
ParticipantHi,
We are replacing OAM with OpenAM. I saw message that we shouldn’t use Client SDK to do authentication remotely, and instead use Rest APIs. Can anyone point me to some examples to do this in Java for the following use-cases:
1. Connect to OpenAM for remote authentication and obtain SSO token.
2. Logout from OpenAM using SSO token.Appreciate any help.
Regards,
SunilJanuary 23, 2017 at 4:50 pm #15480Brad Tumy
ParticipantHere are some resources for you:
OpenAM Developer’s Guide:
https://backstage.forgerock.com/docs/openam/13.5/dev-guide#chap-client-dev*From Google:
http://rest.elkstein.org/2008/02/using-rest-in-java.html*This is clearly an older resource but easily found on Google by searching “rest calls in java”
January 23, 2017 at 10:28 pm #15489mat_sunil
ParticipantThanks for the reply. I was hoping I could use openam-core-rest-13.5.0.jar to make the REST calls. I don’t want to deal with parsing the string. From the test classes I was able to come up with something like below.
CoreServicesWrapper coreServicesWrapper = new CoreServicesWrapper();
LoginAuthenticator loginAuthenticator = new LoginAuthenticator(coreServicesWrapper);
RestAuthCallbackHandlerFactory restAuthCallbackHandlerFactory = RestAuthCallbackHandlerFactory.getInstance();
RestAuthCallbackHandlerManager restAuthCallbackHandlerManager = new RestAuthCallbackHandlerManager(restAuthCallbackHandlerFactory);
AMAuthErrorCodeResponseStatusMapping amAuthErrorCodeResponseStatusMapping = new AMAuthErrorCodeResponseStatusMapping();
JwtBuilderFactory jwtBuilderFactory = new JwtBuilderFactory();
SigningManager signingManager = new SigningManager();
AuthIdHelper authIdHelper = new AuthIdHelper(coreServicesWrapper, jwtBuilderFactory, signingManager);
LoginConfiguration loginConfiguration = new LoginConfiguration();RestAuthenticationHandler restAuthenticationHandler = new RestAuthenticationHandler(loginAuthenticator, restAuthCallbackHandlerManager,
amAuthErrorCodeResponseStatusMapping, authIdHelper);AuthContextLocal authContextLocal = new AuthContextLocal();
AuthContextLocalWrapper authContextLocalWrapper = new AuthContextLocalWrapper(ac);
LoginProcess loginProcess = new LoginProcess(loginAuthenticator, loginConfiguration, authContext, coreServicesWrapper);
loginAuthenticator.getLoginProcess(loginConfiguration);
SignedJwt signedJwt = authIdHelper.reconstructAuthId(“AUTH_ID”);Is there something similar that I could use?
Regards,
Sunil -
AuthorPosts
You must be logged in to reply to this topic.