CAS 5.3.5 Authorization Interrupt & REST

110 views
Skip to first unread message

Shawn Cutting

unread,
Oct 29, 2018, 4:43:46 PM10/29/18
to CAS Community
Greetings.

I am looking for some sort of documentation or other source of help for how to properly use the Authorization Interrupt with a REST page response.  I am able to see the CAS server calling my REST application, and I am able to appropriately process the call on the application, and the result is a straight JSON file in the exact same syntax as the interrupt.json file.

If I use the same information that I am returning from my REST app in the json file, everything works like I would expect.  But the returned JSON does NOT follow the rules that are set in the json code.  It does recognize the specific user and only processes that user, but the rest of the rules are not followed.

Here is what I am returning (with example 'testuser'):

<?php

if ($_GET["username"] == "testuser"){
    header("HTTP/1.1 200 OK");
    header('Content-Type:application/json');

    $array = array("testuser" => array(
        "message" => "This is the announcement message that will tell people what to do",
        "links" => array(
            "Yahoo Link" => urlencode("https://www.yahoo.com"),
            "Google Link"  => urlencode("https://www.google.com")
        ),
        "block" => false,
        "ssoEnabled" => false,
        "interrupt" => true,
        "autoRedirect" => false,
        "autoRedirectAfterSeconds" => -1
    ));

    echo urldecode(json_encode($array));
}
?>

If I put this json layout into the interrupt.json file, it works as it should (the message appears, the links appear, etc).  But when I call this php file, it sees that testuser is the user in play and it does interrupt the login, but the content is the default interrupt information with no custom message, no links.


Has anyone had any success with the interrupt settings and REST?  Any help would be fabulous!

Shawn

Tepe, Dirk

unread,
Oct 29, 2018, 9:29:36 PM10/29/18
to cas-...@apereo.org
The interrupt JSON file contains a mapping of username to interrupt configuration. The REST response is the only the configuration block for the matched user. Drop the 'testuser' key and just return that block:

  {
    "autoRedirect": false,
    "autoRedirectAfterSeconds": -1,
    "block": false,
    "interrupt": true,
    "links": {
        "Google Link": "https://www.google.com",
        "Yahoo Link": "https://www.yahoo.com"
    },
    "message": "This is the announcement message that will tell people what to do",
    "ssoEnabled": false
  }

The 200 Ok response tells CAS to interrupt, but then it can't find the data elements it expects.

-dirk
--
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
---
You received this message because you are subscribed to the Google Groups "CAS Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+u...@apereo.org.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/7329613a-c5f1-4a15-b9fd-340dfad68331%40apereo.org.

Shawn Cutting

unread,
Oct 30, 2018, 8:54:35 AM10/30/18
to CAS Community
Dirk,

You are FABULOUS!!!  That was exactly what it needed.  Thank you for such a quick response, too.

Shawn
Reply all
Reply to author
Forward
0 new messages