StaticResourceHandler for protected apps

Tagged: 

This topic has 0 replies, 1 voice, and was last updated 5 years, 6 months ago by waseem.

  • Author
    Posts
  • #15621
     waseem
    Participant

    hi Team,

    As a sample test am trying to protect the sample URL http://www.w3schools.com/ and whenever i hit http://www.w3schools.com/protected. It should take me to openAM login screen and for some reason the request always take to http://www.w3schools.com/ does not hit my
    openIG server.

    Below is the config’s.

    config.json

    {
        "handler": {
            "type": "Router",
            "audit": "global",
            "baseURI": "http://www.w3schools.com/",
            "capture": "all"
        },
        "heap": [
            {
                "name": "LogSink",
                "type": "ConsoleLogSink",
                "config": {
                    "level": "DEBUG"
                }
            },
            {
                "name": "JwtSession",
                "type": "JwtSession"
            },
            {
                "name": "capture",
                "type": "CaptureDecorator",
                "config": {
                    "captureEntity": true,
                    "_captureContext": true
                }
            }
        ]
    }

    99-default.json

    
    {
        "handler": {
            "type": "DispatchHandler",
            "config": {
                "bindings": [{
                    "condition": "${request.cookies['iPlanetDirectoryPro'] == null}",
                    "handler": {
                        "type": "StaticResponseHandler",
                        "capture": "all",
                        "config": {
                            "status": 302,
                            "reason": "Found",
                            "headers": {
                                "Location": [
                                    "http://OPENAMURL/openam/XUI/#login/&goto=${urlEncode(contexts.router.originalUri)}"
                                ]
                            },
                            "entity": "Redirecting to OpenAM..."
                        }
                    }
                }, {
                    "comment": "This condition is optional, but included for clarity.",
                    "condition": "${request.cookies['iPlanetDirectoryPro'] != null}",
                    "handler": {
                        "type": "Chain",
                        "config": {
                            "filters": [{
                                "type": "ScriptableFilter",
                                "config": {
                                    "type": "application/x-groovy",
                                    "file": "UserAttrs.groovy"
                                }
                            }, {
                                "type": "HeaderFilter",
                                "config": {
                                    "messageType": "REQUEST",
                                    "add": {}
                                }
                            }],
                            "handler": "ClientHandler"
                        }
                    }
                }]
            }
        },
        "condition": "${matches(request.uri.path, '^/protected')}"
    }
    • This topic was modified 5 years, 6 months ago by waseem.
    • This topic was modified 5 years, 6 months ago by waseem.
Viewing 1 post (of 1 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?