Accessing an HTTP header in a custom Elytron domain

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Accessing an HTTP header in a custom Elytron domain

David van Balen
Hi,

I have a web frontend application that is communicating with a beckend REST service. I would like the web frontend to automatically authenticate/authorize with the REST services by including the username and roles of the authenticated user as HTTP headers in the REST call. I found a wildfly quickstart (http-custom-mechanism) which allows me to the authentication part. However, I haven't not been able to figure out how to provide the roles in the same fashion. In the case of the quickstart I mentioned, it would be something like adding an additional HTTP header to the curl call, like so:

-H "X-ROLES:admin,ops"

which would result in the user being assigned the "admin" and "ops" roles in the REST service.

Does anyone have any pointers on how I can do this?

Thanks in advance.


_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|

Re: Accessing an HTTP header in a custom Elytron domain

Martin Choma
This sort of question fits more to wildfly forum, as this is more
developers forum.

In custom http mechanism you can access X-ROLES header in same manner
as you access X-USERNAME header now;
request.getFirstRequestHeaderValue(USERNAME_HEADER)

On Fri, Aug 24, 2018 at 8:18 PM, David van Balen <[hidden email]> wrote:

> Hi,
>
> I have a web frontend application that is communicating with a beckend REST
> service. I would like the web frontend to automatically
> authenticate/authorize with the REST services by including the username and
> roles of the authenticated user as HTTP headers in the REST call. I found a
> wildfly quickstart (http-custom-mechanism) which allows me to the
> authentication part. However, I haven't not been able to figure out how to
> provide the roles in the same fashion. In the case of the quickstart I
> mentioned, it would be something like adding an additional HTTP header to
> the curl call, like so:
>
> -H "X-ROLES:admin,ops"
>
> which would result in the user being assigned the "admin" and "ops" roles in
> the REST service.
>
> Does anyone have any pointers on how I can do this?
>
> Thanks in advance.
>
>
> _______________________________________________
> wildfly-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/wildfly-dev
_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev