Child pages
  • Splited configuration file support
Skip to end of metadata
Go to start of metadata

JIRA:  OPENIG-97 - Getting issue details... STATUS

 

Status: DEPRECATED


The current approach is less invasive from a configuration stand point: it's simply a new handler to declare in the usual configuration file. Conditions are also more expressive since they are expressions and not only a pattern to be matched against the URL.

The picture

Samples

System configuration file

config/system.json
{
  "heap": {
    "objects": [
    {
        "name": "LogSink",
        "comment": "Default sink for logging information.",
        "type": "ConsoleLogSink",
        "config": {
            "level": "DEBUG",
        }
    }
}

 

"App" configuration time

config/app.json
{
    "pattern": "^/app"
    "servletObject": "HandlerServlet",
    "heap": {
        "objects": [
            {
                "name": "HandlerServlet",
                "type": "HandlerServlet",
                "config": {
                    "handler": "DispatchHandler",
                    "baseURI":"http://109.73.67.52:8080"
                }
            },
            {
                "name": "DispatchHandler",
                "type": "DispatchHandler",
                "config": {
                    "bindings": [
                        {
                            "condition": "${exchange.request.uri.path == '/wordpress/wp-login.php'}",
                            "handler": "LoginChain"
                        },
                        {
                            "handler": "OutgoingChain"
                        }
                    ]
                }
            },
            {
                "name": "LoginChain",
                "type": "Chain",
                "config": {
                    "filters": ["CryptoHeaderFilter","LoginRequestFilter"],
                    "handler": "OutgoingChain"
                }
            },
            {   
                "name": "CryptoHeaderFilter",
                "type": "CryptoHeaderFilter",
                "config": {
                    "messageType":"REQUEST",
                    "operation":"DECRYPT",
                    "algorithm":"DES/ECB/NoPadding",
                    "key":"DESKEY",
                    "keyType":"DES",
                    "charSet":"utf-8",
                    "headers": ["password"]
                },
            },
            {
                "name": "LoginRequestFilter",
                "type": "StaticRequestFilter",
                "config": {
                    "method": "POST",
                    "uri": "http://109.73.67.52:8080/wordpress/wp-login.php",
                    "form": {
                        "log": ["${exchange.request.headers['username'][0]}"],
                        "pwd": ["${exchange.request.headers['password'][0]}"],
                        "rememberme": ["forever"],
                        "redirect_to" : ["http://109.73.67.52:8080/wordpress/wp-admin/"],
                        "testcookie": ["1"]
                    }
                }
            }, 
            {
                "name": "OutgoingChain",
                "type": "Chain",
                "config": {
                    "filters": ["HeaderFilter","CaptureFilter"],
                    "handler": "ClientHandler"
                }
            },
            {
                "name": "HeaderFilter",
                "type": "HeaderFilter",
                "config": {
                    "messageType":"REQUEST",
                    "remove": ["password","username"]
                 }
            },
            {
                "name": "CaptureFilter",
                "type": "CaptureFilter",
                "config": {
                    "captureEntity": false,
                    "file": "/tmp/gateway.log"
                }
            },
            {
                "name": "ClientHandler",
                "type": "ClientHandler",
                "config": {
                }
            },
        ]
    }
}

 

Benefits

  • Maximum component re-use, no need to re-develop another routing filter/handler/whatever
  • Minimum impact on configuration files

 

  • No labels