Remote authentication using Rest API

This topic has 2 replies, 2 voices, and was last updated 5 years, 6 months ago by mat_sunil.

  • Author
  • #15479


    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.


     Brad Tumy

    Here are some resources for you:

    OpenAM Developer’s Guide:

    *From Google:

    *This is clearly an older resource but easily found on Google by searching “rest calls in java”

    • This reply was modified 5 years, 6 months ago by Brad Tumy.
    • This reply was modified 5 years, 6 months ago by Brad Tumy.
    • This reply was modified 5 years, 6 months ago by Brad Tumy.

    Thanks 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);
    SignedJwt signedJwt = authIdHelper.reconstructAuthId(“AUTH_ID”);

    Is there something similar that I could use?


Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

©2022 ForgeRock - we provide an identity and access platform to secure every online relationship for the enterprise market, educational sector and even entire countries. Click to view our privacy policy and terms of use.

Log in with your credentials

Forgot your details?