Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to get the email stored in the x-vouch-user header as a variable in my app? #476

Closed
brokeDude2901 opened this issue Jun 6, 2022 · 3 comments
Labels

Comments

@brokeDude2901
Copy link

My case:
mysite.com:9090/vouch_proxy_path
mysite.com:8443 (java 8 dropwizard backend)

Expected flow:
step1. vouch-proxy Google login success
step2. send POST request to mysite.com:8443/register
to create a new $username as vouch-proxy Google email and generate $password, then store in server file user.json
step3. user now able to speak to server via HTTP authorization header

Problem is i dont know how to get Google email as variable in step2. Any help would be nice :)

@bnfinet
Copy link
Member

bnfinet commented Jun 6, 2022

@brokeDude2901 what generates the POST? Is that the browser or a server process?

If it's the browser then you'll need to get the header from an xhr request to the current URL 'with credentials'. The response will give you the header.

If it's the server then that's documented in 'config.yml_example'

@bnfinet bnfinet changed the title vouch-proxy user management with HTTP/HTTPS basic authentication how to get email as variable? Jun 6, 2022
@bnfinet
Copy link
Member

bnfinet commented Jun 6, 2022

Here's how to pass the x-vouch-user from NGINX which in the case of Google will hold the email..
#421 (comment)

And this shows how to use it from a SPA / browser based request (XHR)..
#416 (comment)

@bnfinet bnfinet changed the title how to get email as variable? how to get the email stored in the x-vouch-user header as a variable in my app? Jun 6, 2022
@brokeDude2901
Copy link
Author

Thanks for the assist, it sure help ! For those having same problem, all i did was:

In nginx.conf file your server block:
proxy_set_header Client-Email $auth_resp_x_vouch_user;

and for java dropwizard:
String username = requestContext.getHeaders().getFirst("Client-Email");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants