Uploaded image for project: 'Identity Gateway'
  1. Identity Gateway
  2. OPENIG-2173

FileAttributesFilter : property "file" cannot be set using fileuri format

    XMLWordPrintable

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 6.0.0
    • None
    • None
    • OS : OSX 10.12.6
      container : Tomcat 8.5.20
      jdk : 1.8.0_131
      IG 6.0.0-SNAPSHOT (3dacf0b2681)

    Description

      With the following route

      {
          "handler": {
              "config": {
                  "handler": "ClientHandler",
                  "filters": [
                      {
                          "config": {
                              "credentials": {
                                  "config": {
                                      "value": "george@example.com",
                                      "key": "email",
                                      "file": "file:///tmp/userfile",
                                      "target": "${attributes.credentials}"
                                  },
                                  "type": "FileAttributesFilter"
                              },
                              "loginPage": "${true}",
                              "request": {
                                  "method": "POST",
                                  "form": {
                                      "username": [
                                          "${attributes.credentials.username}"
                                      ],
                                      "password": [
                                          "${attributes.credentials.password}"
                                      ]
                                  },
                                  "uri": "http://app.example.com:8081/login"
                              }
                          },
                          "type": "PasswordReplayFilter"
                      }
                  ]
              },
              "type": "Chain"
          },
          "condition": "${matches(request.uri.path, '^/file')}"
      }
      

      When accessing the route, I get a 401 response status_code, and the following error in logs :

      21:21:06:324 | WARN  | http-nio-8080-exec-8 | o.f.o.f.FileAttributesFilter | @02-file | Unable to retrieve a row where column email value is equal to george@example.com
      java.io.FileNotFoundException: file:/tmp/userfile (No such file or directory)
      	at java.io.FileInputStream.open0(Native Method)
      	at java.io.FileInputStream.open(FileInputStream.java:195)
      	at java.io.FileInputStream.<init>(FileInputStream.java:138)
      	at org.forgerock.openig.text.SeparatedValuesFile.getRecord(SeparatedValuesFile.java:151)
      	at org.forgerock.openig.filter.FileAttributesFilter.lambda$filter$0(FileAttributesFilter.java:109)
      	at org.forgerock.util.LazyMap.lazy(LazyMap.java:58)
      	at org.forgerock.util.LazyMap.get(LazyMap.java:120)
      	at org.forgerock.openig.resolver.MapResolver.get(MapResolver.java:43)
      	at org.forgerock.openig.resolver.Resolvers.get(Resolvers.java:124)
      	at org.forgerock.openig.el.Expression$XLResolver.getValue(Expression.java:217)
      	at de.odysseus.el.tree.impl.ast.AstProperty.eval(AstProperty.java:77)
      	at de.odysseus.el.tree.impl.ast.AstEval.eval(AstEval.java:51)
      	at de.odysseus.el.tree.impl.ast.AstNode.getValue(AstNode.java:31)
      	at de.odysseus.el.TreeValueExpression.getValue(TreeValueExpression.java:122)
      	at org.forgerock.openig.el.Expression.eval(Expression.java:141)
      	at org.forgerock.openig.filter.StaticRequestFilter.filter(StaticRequestFilter.java:229)
      	at org.forgerock.http.handler.Handlers$1.handle(Handlers.java:53)
      	at org.forgerock.openig.filter.FileAttributesFilter.filter(FileAttributesFilter.java:122)
      	at org.forgerock.http.handler.Handlers$1.handle(Handlers.java:53)
      	at org.forgerock.openig.filter.PasswordReplayFilterHeaplet$1.filter(PasswordReplayFilterHeaplet.java:295)
      	at org.forgerock.http.handler.Handlers$1.handle(Handlers.java:53)
      	at org.forgerock.openig.handler.router.NullResponseFilter.filter(NullResponseFilter.java:37)
      	at org.forgerock.http.handler.Handlers$1.handle(Handlers.java:53)
      	at org.forgerock.openig.filter.RuntimeExceptionFilter.filter(RuntimeExceptionFilter.java:39)
      	at org.forgerock.http.handler.Handlers$1.handle(Handlers.java:53)
      	at org.forgerock.openig.filter.LogAttachedExceptionFilter.filter(LogAttachedExceptionFilter.java:33)
      	at org.forgerock.http.handler.Handlers$1.handle(Handlers.java:53)
      	at org.forgerock.openig.handler.router.MetricsFilter.filter(MetricsFilter.java:47)
      	at org.forgerock.http.handler.Handlers$1.handle(Handlers.java:53)
      	at org.forgerock.openig.filter.MdcRouteIdFilter.filter(MdcRouteIdFilter.java:43)
      	at org.forgerock.http.handler.Handlers$1.handle(Handlers.java:53)
      	at org.forgerock.openig.handler.router.Route.handle(Route.java:156)
      	at org.forgerock.openig.handler.router.RouterHandler.handle(RouterHandler.java:347)
      	at org.forgerock.http.handler.Handlers$UndescribedAsDescribableHandler.handle(Handlers.java:179)
      	at org.forgerock.openig.decoration.baseuri.BaseUriFilter.filter(BaseUriFilter.java:55)
      	at org.forgerock.http.handler.Handlers$1.handle(Handlers.java:53)
      	at org.forgerock.openig.decoration.capture.CaptureHandler.handle(CaptureHandler.java:54)
      	at org.forgerock.http.handler.Handlers$UndescribedAsDescribableHandler.handle(Handlers.java:179)
      	at org.forgerock.http.filter.TransactionIdInboundFilter.filter(TransactionIdInboundFilter.java:75)
      	at org.forgerock.http.handler.Handlers$1.handle(Handlers.java:53)
      	at org.forgerock.http.servlet.HttpFrameworkServlet.service(HttpFrameworkServlet.java:258)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
      	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
      	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
      	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
      	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
      	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
      	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
      	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
      	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
      	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1457)
      	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      	at java.lang.Thread.run(Thread.java:748)
      

      Updating the route by replacing:

      "file": "file:///tmp/userfile",
      

      by

      "file": "/tmp/userfile",
      

      makes the route work properly.... (file `/tmp/userfile` indeed exists !)

      Consequence on Windows :
      As neither a path nor a fileurl can be set, the only one way to define the property `file` is to use an expression.

      QA info :
      1 - git pull PyForge
      2 - python cleanup.py -f
      2 - python configure.py
      3 - using aliases defined in /PyForge/PyBot/OpenIG/tools/.bash_qa_tools :
      igd; rig -s GatewayGuide/ -t Accessing_the_file_route_should_succeed -n
      Servers are then available for checks... (test currently working because workarounded)
      5 - python cleanup.py -f

      Attachments

        Activity

          People

            Unassigned Unassigned
            jcdevil Jean-Charles Deville
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: