IBM Verify

IBM Verify

Join this online user group to communicate across Security product users and IBM experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  AAC Policy as REST

    Posted 06/01/21 06:26 AM
    Edited by Joao Goncalves 06/01/21 06:31 AM
    What I really need is to implement a service in the appliance that will be called using the "SMS One-time password" mechanism.

    Is it possible to invoke a REST Policy (http://<reverse-proxy>/mga/sps/authsvc?PolicyId=urn:...:myPolicy) and just have it return a response?

    If the first step in the REST Policy process is a InfoMap, I will need to specify the template page, which I don't need, since I just want to the mapping rule, and likely will not work.

    Which other options can I use?

    ------------------------------
    Joao Goncalves
    Pyxis, Lda.
    +351 91 721 4994
    ------------------------------


  • 2.  RE: AAC Policy as REST

    Posted 06/01/21 06:59 AM
    Hi Joao,

    You can't directly specify a response to return, it is always a template page.  However, the template page could contain a single macro which is populated from within the InfoMap.  If your InfoMap returns "end policy without credentials", this will cause the specified template page to be returned immediately.

    Jon.

    ------------------------------
    Jon Harry
    Consulting IT Security Specialist
    IBM
    ------------------------------



  • 3.  RE: AAC Policy as REST

    Posted 06/01/21 07:08 AM
    Really don't understand what you mean.
    Should I create a template page with a content like <html><body>@EMAIL@</body></html>, with just a macro?

    Then the mapping rule can just populate the @EMAIL@ macro, and do whatever I need, and return a json file as a result of the policyId?


    ------------------------------
    Joao Goncalves
    Pyxis, Lda.
    +351 91 721 4994
    ------------------------------



  • 4.  RE: AAC Policy as REST

    Posted 06/01/21 08:26 AM
    Hi Joao,

    I got the impression you were hoping to return a JSON response from the policy?  In that case your template page would probably be more like:

    @JSON@

    and then populate the JSON into that macro  within your InfoMap JavaScript.
    If you need to set headers (content-type etc.), I think you could do that with service-side scripting capability in the template also.

    If I misunderstood what you're trying to do then please correct me.

    Jon.

    ------------------------------
    Jon Harry
    Consulting IT Security Specialist
    IBM
    ------------------------------



  • 5.  RE: AAC Policy as REST

    Posted 06/01/21 09:30 AM
    Is it possible to pass parameters other than PolicyId to the URL authsvc? How can I get them, in the InfoMap?

    ------------------------------
    Joao Goncalves
    Pyxis, Lda.
    +351 91 721 4994
    ------------------------------



  • 6.  RE: AAC Policy as REST

    Posted 06/01/21 09:42 AM
    Joao,

    You can pass additional query string parameters in the call to the AAC authentication service.

    ...?PolicyId=....&myattr=test

    You can read them out from the request context:

     var myattr = context.get(Scope.REQUEST, "urn:ibm:security:asf:request:parameter", "myattr");


    Jon.

    ------------------------------
    Jon Harry
    Consulting IT Security Specialist
    IBM
    ------------------------------



  • 7.  RE: AAC Policy as REST

    Posted 06/01/21 10:36 AM
    Edited by Jon Harry 06/01/21 10:37 AM
    Hi Joao,

    Something else I should have mentioned before...

    If you're calling the AAC Authentication Service from a REST client (working with JSON) then you should use the API endpoint instead of the standard endpoint:

    http://<reverse-proxy>/mga/sps/apiauthsvc?PolicyId=urn:...:myPolicy

    In this case the authentication service will expect to receive POST and get incoming attributes within body as JSON format:

    {
       myAttr: "test"
    }

    It will also look for a template file with .html replaced with .json when building responses.  This will set the response type to application/json too.

    If your policy will require multiple steps then you should include @ACTION@ and @STATE@ macros in your responses.  These are needed so that the next call can include the stateId query string which links it into the in-progress policy (rather than using cookies).

    You can see examples of this within the built-in InfoMaps in the AAC.  If you search in the AAC template pages for .json files you'll find them in the ci folder and in eula folder etc.

    Jon.​​

    ------------------------------
    Jon Harry
    Consulting IT Security Specialist
    IBM
    ------------------------------