Skip to content
This repository has been archived by the owner on Dec 8, 2017. It is now read-only.

Embed access token as Javascript variable via SSI #241

Merged
merged 1 commit into from
Apr 3, 2015

Conversation

mbland
Copy link
Contributor

@mbland mbland commented Apr 3, 2015

The motivation for this is to pass the authenticated user's MyUSA access token
through so that Javascript can be used to request Midas data per #211. More
generally, this should allow us to integrate other backend services that
accept MyUSA access tokens. (Care must be taken, of course, to ensure that
tokens are sent only over secure connetions.)

The upstream auth proxy will pass the OAuth access_token into the Hub server
via the X-Forwarded-Access-Token HTTP header. We then use the Nginx set
directive to rewrite this header's value as the access_token variable, which
then gets assigned to a Javascript variable via the #echo Server-Side
Include directive.

cc: @dhcole @afeld @adelevie @yozlet @jackiekazil

@coveralls
Copy link

Coverage Status

Coverage remained the same at 76.58% when pulling 30990b231c3dfb063d7b8da95f7b46231547d832 on embed-access-token into fcd7214 on master.

The motivation for this is to pass the authenticated user's MyUSA access token
through so that Javascript can be used to request Midas data per #211. More
generally, this should allow us to integrate other backend services that
accept MyUSA access tokens. (Care must be taken, of course, to ensure that
tokens are sent only over secure connetions.)

The upstream auth proxy will pass the OAuth `access_token` into the Hub server
via the `X-Forwarded-Access-Token` HTTP header. We then use the Nginx `set`
directive to rewrite this header's value as the `access_token` variable, which
then gets assigned to a Javascript variable via the `#echo` Server-Side
Include directive.
@mbland mbland force-pushed the embed-access-token branch from 30990b2 to 61317cd Compare April 3, 2015 13:48
@coveralls
Copy link

Coverage Status

Coverage remained the same at 76.58% when pulling 61317cd on embed-access-token into 7fbe533 on master.

@mbland mbland changed the title [WIP] Embed access token as Javascript variable via SSI Embed access token as Javascript variable via SSI Apr 3, 2015
@mbland
Copy link
Contributor Author

mbland commented Apr 3, 2015

@dhcole This good to go, now that bitly/oauth2_proxy#80 is in and running on hub.18f.us. After merging this, then we should then be able to get #211 in soon.

@dhcole
Copy link
Contributor

dhcole commented Apr 3, 2015

Nice work. Great that this made it upstream. Keeps this code very simple. 👍 on this, and I'll review #211 and update accordingly.

dhcole added a commit that referenced this pull request Apr 3, 2015
Embed access token as Javascript variable via SSI
@dhcole dhcole merged commit d2281ea into master Apr 3, 2015
@mbland mbland deleted the embed-access-token branch April 3, 2015 20:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants