Re: Differences between conf and topologies

2019-04-01 Thread Odon Copon
Thanks Kevin,
So, does it mean that gateway-site.xml o overwrites any configuration set
as part of manager.xml?

Thanks

On Mon, 1 Apr 2019, 19:33 Kevin Risden,  wrote:

> The UI configuration comes from "topologies/manager.xml". If you look at
> the manager.xml, it can reference configurations in the global
> "conf/gateway-site.xml" if it wants to. Topologies don't need to though.
> You could technically move the group config stuff from
> "conf/gateway-site.xml" to the manager.xml file.
>
> The example topologies that ship with Knox show that it is possible to
> configure some settings in "conf/gateway-site.xml" but it is not necessary.
>
> The example is one you already referenced which is the group lookup:
> *
> https://github.com/apache/knox/blob/master/gateway-release/home/conf/gateway-site.xml#L94
> *
> https://github.com/apache/knox/blob/master/gateway-release/home/conf/topologies/manager.xml#L60
>
> Kevin Risden
>
>
> On Mon, Apr 1, 2019 at 11:33 AM Odon Copon  wrote:
>
>> Hi Kevin,
>> Thank for the clarification.
>> What do you mean by "One of those is the group configurations"? Would be
>> possible to provide an example?
>>
>> Based on your comment, does it mean the LDAP configuration to access the
>> UI comes from "conf/gateway-site.xml"?
>>
>> Thanks!
>>
>> On Mon, 1 Apr 2019 at 16:16,
>> Kevin Risden
>>  wrote:
>>
>>> "conf/gateway-site.xml" has configurations that are global to the entire
>>> Knox instance.
>>>
>>> "topologies/abc.xml" are configurations specific to the topology. The
>>> topologies can reference some configurations in the global
>>> "conf/gateway-site.xml". One of those is the group configurations. This
>>> would be useful to say have multiple topologies not have to repeat the same
>>> configuration over and over again. On the other hand, you can so choose to
>>> duplicate the configuration in each topology.
>>>
>>> Kevin Risden
>>>
>>>
>>> On Mon, Apr 1, 2019 at 11:13 AM Odon Copon  wrote:
>>>
 Hi,
 What are the main differences between "conf/gateway-site.xml",
 "topologies/manager.xml" and "topologies/admin.xml"?
 I'm still trying to understand how all work together in Knox.

 Per example, I can see there's a section for LDAP configuration on
 "topologies/admin.xml" but also as part of "conf/gateway-site.xml". Which
 one affects what exactly?

 Thanks

>>>


Re: Differences between conf and topologies

2019-04-01 Thread Kevin Risden
"conf/gateway-site.xml" has configurations that are global to the entire
Knox instance.

"topologies/abc.xml" are configurations specific to the topology. The
topologies can reference some configurations in the global
"conf/gateway-site.xml". One of those is the group configurations. This
would be useful to say have multiple topologies not have to repeat the same
configuration over and over again. On the other hand, you can so choose to
duplicate the configuration in each topology.

Kevin Risden


On Mon, Apr 1, 2019 at 11:13 AM Odon Copon  wrote:

> Hi,
> What are the main differences between "conf/gateway-site.xml",
> "topologies/manager.xml" and "topologies/admin.xml"?
> I'm still trying to understand how all work together in Knox.
>
> Per example, I can see there's a section for LDAP configuration on
> "topologies/admin.xml" but also as part of "conf/gateway-site.xml". Which
> one affects what exactly?
>
> Thanks
>


Differences between conf and topologies

2019-04-01 Thread Odon Copon
Hi,
What are the main differences between "conf/gateway-site.xml",
"topologies/manager.xml" and "topologies/admin.xml"?
I'm still trying to understand how all work together in Knox.

Per example, I can see there's a section for LDAP configuration on
"topologies/admin.xml" but also as part of "conf/gateway-site.xml". Which
one affects what exactly?

Thanks


Re: Add a filter to intercept Knox requests and be able to add a custom logic

2019-04-01 Thread Matteo Alessandroni

Hi,

great, thank you so much for the help!

Best regards,
Matteo


On 29/03/19 17:22, Kevin Risden wrote:
Should be able to use the default http client that is included in 
Knox. Should be accessible with getHttpClient() from 
AbstractGatewayDispatch.


Kevin Risden


On Fri, Mar 29, 2019 at 11:22 AM Matteo Alessandroni 
mailto:skylar...@apache.org>> wrote:


Hi,

Phil the "SubjectUtils.getCurrentEffectivePrincipalName()" method
did the trick, thanks!

Does anybody of you guys know how I could use a CXF REST client
from my Dispatch class (that extends "DefaultDispatch") to call an
external link?
I tried to make a ".jar" that also includes the following dependencies


  org.apache.cxf
cxf-rt-frontend-jaxrs


  org.apache.cxf
  cxf-rt-rs-client


  org.apache.cxf
cxf-rt-transports-http


  org.apache.cxf
cxf-rt-transports-http-jetty


in order to execute:

MyRequest request = new MyRequest();
Client client = ClientBuilder.newBuilder().newClient();
WebTarget target = client.target(MYURL);
Invocation.Builder builder =
target.request(MediaType.APPLICATION_JSON_TYPE);
MyResponse response =
    builder.post(Entity.json(request.toString()),
MyResponse.class);

from the "executeRequest()" method:

@Override
protected void *executeRequest*(
    HttpUriRequest outboundRequest,
    HttpServletRequest inboundRequest,
    HttpServletResponse outboundResponse) throws IOException {

but it does not work and it says:

javax.ws.rs.ProcessingException: org.apache.cxf.BusException: No
conduit initiator was found for the namespace
http://cxf.apache.org/transports/http.
    at

org.apache.cxf.jaxrs.client.AbstractClient.checkClientException(AbstractClient.java:638)
    at

org.apache.cxf.jaxrs.client.AbstractClient.preProcessResult(AbstractClient.java:614)
    at
org.apache.cxf.jaxrs.client.WebClient.doResponse(WebClient.java:1115)
    at

org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1052)
    at
org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:897)
    at
org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:866)
    at
org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:431)
    at
org.apache.cxf.jaxrs.client.SyncInvokerImpl.method(SyncInvokerImpl.java:150)
    at
org.apache.cxf.jaxrs.client.SyncInvokerImpl.post(SyncInvokerImpl.java:90)
    at

org.apache.cxf.jaxrs.client.spec.InvocationBuilderImpl.post(InvocationBuilderImpl.java:158)

is there something built-in I can use? Or maybe I'm doing
something wrong with the CXF client?

Thanks



On 18/03/19 09:03, Matteo Alessandroni wrote:

Hi Phil,

thank you for the help!
I'll check that class and will let you know.

Thanks again!
Regards,
Matteo



On 15/03/19 17:05, Phil Zampino wrote:

I was going to suggest that you might be experiencing a docker
issue because the ext folder works; You beat me to it.

I'm not sure if this is what you're after, but
org.apache.knox.gateway.security.SubjectUtils might be of use to
you for identifying the currently logged-in principal.

On Fri, Mar 15, 2019 at 11:53 AM Matteo Alessandroni
mailto:skylar...@apache.org>> wrote:

Ok I think I found the issue:
I had to restart the full Docker container to actually
restart Knox.
So I did that and it seems it's getting my class in "ext/" now.

The error I get now is:

Caused by:
org.apache.knox.gateway.config.ConfigurationException:
Failed to find configuration for provider as provider of
org.apache.knox.gateway.dispatch.MyCustomDispatch via
org.apache.knox.gateway.config.FilterConfigurationAdapter

so I guess it's a problem with my class code.
Is there a very simple code snippetI could use for my custom
dispatch in order to access the "request" object in order to
get the name of the user that is currently logged?

Regards,
Matteo


On 15/03/19 15:49, Matteo Alessandroni wrote:

Thanks!
I checked that too, my ".jar" has the same permissions of
the other files in "lib/" folder (e.g.
"gateway-shell-1.2.0.jar").
I see your point about the script [1], but I also see that
the original gateway.sh (for Knox v1.2.0) [2] is not doing
anything special for the "ext/" folder, or am I wrong?

Regards,
Matteo


[1]

https://github.com/moresandeep/knox-dev-docker/blob/master/build/gateway.sh
[2]

https://github.com/apache/knox/blob/v1.2.0/gateway-release/home/bin/gateway.sh


On 15/03/19 15:27, Sandeep Moré wrote:

Ah, i missed the