UnauthorizedException with HTTP authentication

23 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Victor M.

ungelesen,
27.04.2015, 10:07:1227.04.15
an empir...@googlegroups.com
Hello there,

I have an application with Empire RDF running on an Apache Tomcat server along with a Sesame RDF repository. From what I have read, Sesame does not support internal authentication methods, so access control needs to be done in HTTP level. I have set some permission roles for the Sesame repository and tried to run my application with the following properties:

annotation.index = examples.empire.annotation.config
0.name = SGR
0.factory = sesame
0.url = http://localhost:8080/openrdf-sesame
0.repo = test
0.user = a_user
0.password = a_password

The application's log files show the following trace:

2015-04-27 15:11:01,247 ERROR [http-nio-8080-exec-1] govRep.dbController.DatabaseController loadObjects - catching
javax.persistence.PersistenceException: com.clarkparsia.empire.ds.QueryException: org.openrdf.repository.http.HTTPQueryEvaluationException
    at com.clarkparsia.empire.impl.RdfQuery.getResultList(RdfQuery.java:418) ~[empire-0.8.6.jar:?]
    at govRep.dbController.DatabaseController.loadObjects(DatabaseController.java:317) [DatabaseController.class:?]
    at govRep.dbController.DatabaseController.getAllUsers(DatabaseController.java:388) [DatabaseController.class:?]
    at govRep.model.config.Configuration.init(Configuration.java:56) [Configuration.class:?]
    at govRep.viewModel.MainBean.<init>(MainBean.java:181) [MainBean.class:?]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.7.0_75]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) [?:1.7.0_75]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [?:1.7.0_75]
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526) [?:1.7.0_75]
    at java.lang.Class.newInstance(Class.java:379) [?:1.7.0_75]
    at com.sun.faces.mgbean.BeanBuilder.newBeanInstance(BeanBuilder.java:186) [jsf-impl-2.2.8.jar:2.2.8]
    at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:100) [jsf-impl-2.2.8.jar:2.2.8]
    at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:409) [jsf-impl-2.2.8.jar:2.2.8]
    at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:269) [jsf-impl-2.2.8.jar:2.2.8]
    at com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:257) [jsf-impl-2.2.8.jar:2.2.8]
    at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:117) [jsf-impl-2.2.8.jar:2.2.8]
    at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176) [jsf-impl-2.2.8.jar:2.2.8]
    at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203) [jsf-impl-2.2.8.jar:2.2.8]
    at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:80) [jasper-el.jar:8.0.21]
    at org.apache.el.parser.AstValue.getValue(AstValue.java:135) [jasper-el.jar:8.0.21]
    at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184) [jasper-el.jar:8.0.21]
    at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109) [jsf-impl-2.2.8.jar:2.2.8]
    at com.sun.faces.facelets.tag.TagAttributeImpl.getObject(TagAttributeImpl.java:356) [jsf-impl-2.2.8.jar:2.2.8]
    at com.sun.faces.facelets.tag.TagAttributeImpl.getValue(TagAttributeImpl.java:322) [jsf-impl-2.2.8.jar:2.2.8]
    at com.sun.faces.facelets.tag.ui.IncludeHandler.apply(IncludeHandler.java:112) [jsf-impl-2.2.8.jar:2.2.8]
    at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137) [jsf-api-2.2.8.jar:2.2]
    at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:203) [jsf-impl-2.2.8.jar:2.2.8]
    at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120) [jsf-api-2.2.8.jar:2.2]
    at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95) [jsf-api-2.2.8.jar:2.2]
    at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137) [jsf-api-2.2.8.jar:2.2]
    at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:203) [jsf-impl-2.2.8.jar:2.2.8]
    at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120) [jsf-api-2.2.8.jar:2.2]
    at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95) [jsf-api-2.2.8.jar:2.2]
    at javax.faces.view.facelets.DelegatingMetaTagHandler.applyNextHandler(DelegatingMetaTagHandler.java:137) [jsf-api-2.2.8.jar:2.2]
    at com.sun.faces.facelets.tag.jsf.ComponentTagHandlerDelegateImpl.apply(ComponentTagHandlerDelegateImpl.java:203) [jsf-impl-2.2.8.jar:2.2.8]
    at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:120) [jsf-api-2.2.8.jar:2.2]
    at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95) [jsf-api-2.2.8.jar:2.2]
    at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93) [jsf-impl-2.2.8.jar:2.2.8]
    at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:87) [jsf-impl-2.2.8.jar:2.2.8]
    at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:161) [jsf-impl-2.2.8.jar:2.2.8]
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:990) [jsf-impl-2.2.8.jar:2.2.8]
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:99) [jsf-impl-2.2.8.jar:2.2.8]
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.2.8.jar:2.2.8]
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219) [jsf-impl-2.2.8.jar:2.2.8]
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647) [jsf-api-2.2.8.jar:2.2]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) [catalina.jar:8.0.21]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.21]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-websocket.jar:8.0.21]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [catalina.jar:8.0.21]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.21]
    at govRep.NoCacheFilter.doFilter(NoCacheFilter.java:40) [NoCacheFilter.class:?]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [catalina.jar:8.0.21]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.21]
    at org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71) [log4j-web-2.1.jar:2.1]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) [catalina.jar:8.0.21]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:8.0.21]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) [catalina.jar:8.0.21]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) [catalina.jar:8.0.21]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) [catalina.jar:8.0.21]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) [catalina.jar:8.0.21]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [catalina.jar:8.0.21]
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610) [catalina.jar:8.0.21]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [catalina.jar:8.0.21]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518) [catalina.jar:8.0.21]
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091) [tomcat-coyote.jar:8.0.21]
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668) [tomcat-coyote.jar:8.0.21]
    at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223) [tomcat-coyote.jar:8.0.21]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1517) [tomcat-coyote.jar:8.0.21]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1474) [tomcat-coyote.jar:8.0.21]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [?:1.7.0_75]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [?:1.7.0_75]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:8.0.21]
    at java.lang.Thread.run(Thread.java:745) [?:1.7.0_75]
Caused by: com.clarkparsia.empire.ds.QueryException: org.openrdf.repository.http.HTTPQueryEvaluationException
    at com.clarkparsia.empire.sesame.RepositoryDataSource.selectQuery(RepositoryDataSource.java:221) ~[empire-sesame-0.8.6.jar:?]
    at com.clarkparsia.empire.impl.RdfQuery.getResultList(RdfQuery.java:365) ~[empire-0.8.6.jar:?]
    ... 72 more
Caused by: org.openrdf.repository.http.HTTPQueryEvaluationException
    at org.openrdf.repository.http.HTTPTupleQuery.evaluate(HTTPTupleQuery.java:59) ~[sesame-repository-http-2.7.12.jar:?]
    at com.clarkparsia.empire.sesame.RepositoryDataSource.selectQuery(RepositoryDataSource.java:216) ~[empire-sesame-0.8.6.jar:?]
    at com.clarkparsia.empire.impl.RdfQuery.getResultList(RdfQuery.java:365) ~[empire-0.8.6.jar:?]
    ... 72 more
Caused by: org.openrdf.http.protocol.UnauthorizedException
    at org.openrdf.http.client.HTTPClient.handleHTTPError(HTTPClient.java:940) ~[sesame-http-client-2.7.12.jar:?]
    at org.openrdf.http.client.HTTPClient.sendTupleQueryViaHttp(HTTPClient.java:718) ~[sesame-http-client-2.7.12.jar:?]
    at org.openrdf.http.client.HTTPClient.getBackgroundTupleQueryResult(HTTPClient.java:602) ~[sesame-http-client-2.7.12.jar:?]
    at org.openrdf.http.client.HTTPClient.sendTupleQuery(HTTPClient.java:367) ~[sesame-http-client-2.7.12.jar:?]
    at org.openrdf.repository.http.HTTPTupleQuery.evaluate(HTTPTupleQuery.java:53) ~[sesame-repository-http-2.7.12.jar:?]
    at com.clarkparsia.empire.sesame.RepositoryDataSource.selectQuery(RepositoryDataSource.java:216) ~[empire-sesame-0.8.6.jar:?]
    at com.clarkparsia.empire.impl.RdfQuery.getResultList(RdfQuery.java:365) ~[empire-0.8.6.jar:?]
    ... 72 more

I am not sure if it is possible to send a username and a password along with the connection attempt with Empire. I could not find a way to set those through the API after browsing through the source code as well. Any suggestions are appreciated.

Best regards,
Victor M.

Michael Grove

ungelesen,
27.04.2015, 10:09:4927.04.15
an empir...@googlegroups.com
The Sesame API does support passing through a username & password via HTTPRepository, but Empire does not support that configuration.  The factory that controls the creation of the Sesame RepositoryConnection would have to be modified to handle this.

Cheers,

Mike
 

Best regards,
Victor M.

--
You received this message because you are subscribed to the Google Groups "Empire" group.
To unsubscribe from this group and stop receiving emails from it, send an email to empire-rdf+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vats

ungelesen,
27.04.2015, 10:12:0327.04.15
an empir...@googlegroups.com
Oh I see. Thank you for the swift response.

Best regards,
Victor M.

Victor M.

---
"Si vis pacem, para bellum" - Publius Flavius Vegetius Renatus

--
You received this message because you are subscribed to a topic in the Google Groups "Empire" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/empire-rdf/WKfsTlwk0ZQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to empire-rdf+...@googlegroups.com.
Allen antworten
Antwort an Autor
Weiterleiten
0 neue Nachrichten