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

Atlassian ASAP Authentication Support #566

Merged
merged 2 commits into from Nov 7, 2017
Merged

Conversation

@gerrytan
Copy link
Contributor

gerrytan commented Nov 4, 2017

This PR adds a new authentication dropdown "Atlassian ASAP" that takes 5 fields: issuer, subject, audience, key id and private key. Input from those fields will be passed to jwt-authenticator which gives a JWT token to be embedded on the request as the Authorization header.

As part of the work a new npm dependency to jwt-authenticator is added.

See also ASAP spec here: https://s2sauth.bitbucket.io.

Closes #565

pasted_image_4_11_17__5_58_am

Note about private key field

The example shown in the placeholder is multi-line PEM format which doesn't work very well with nunjucks environment data (each newline has to be replaced with escaped '\n'), but jwt-authentication also support single line data-uri format (see export-as-data-uri in asap-cli). I've added a help text tooltip next to the field label with this info.

A possible future improvement is to ask the user whether they want to copy-paste the private key, or point directly to the file (maybe provide a select dropdown in the place of the private key label).

'CgffdGcsK7MmUUgAG7r05b0mljhI35t/0Y57MwIDAQABAoIBAQCH1rLohudJmROp\n' +
'Gl/qAewfQiiZlfATQavCDGuDGL1YAIme8a8GgApNYf2jWnidhiqJgRHBRor+yzFr\n' +
'cJV+wRTs/Szp6LXAgMmTkKMJ+9XXErUIUgwbl27Y3Rv/9ox1p5VRg+A=\n' +
'-----END RSA PRIVATE KEY-----';

This comment has been minimized.

Copy link
@gerrytan

gerrytan Nov 4, 2017

Author Contributor

Yes I created a throwaway private key for this placeholder example :)

@gschier

This comment has been minimized.

Copy link
Contributor

gschier commented Nov 5, 2017

Thanks for this! I will take a closer look this week.

@gschier

This comment has been minimized.

Copy link
Contributor

gschier commented Nov 6, 2017

@gerrytan would this help with the multi-line private key issue? #557
It allows you to reference the contents of a file from anywhere. I assume the user would have the key on their filesystem in most cases already? I could be wrong, though.

@gschier
gschier approved these changes Nov 7, 2017
Copy link
Contributor

gschier left a comment

Looks good! Thanks @gerrytan 👍

P.S. I'll fix the build error after merging.

@gschier gschier merged commit f67f220 into Kong:develop Nov 7, 2017
0 of 2 checks passed
0 of 2 checks passed
continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build failed
Details
@gerrytan

This comment has been minimized.

Copy link
Contributor Author

gerrytan commented Nov 8, 2017

Thanks @gschier!, I'll take a look at your suggestion on multi-line private key issue some time next week.

@gerrytan

This comment has been minimized.

Copy link
Contributor Author

gerrytan commented Nov 13, 2017

@gschier now I understand what you mean with the file template tag, thanks! Yes it would solve the problem. I'll raise another PR to reword the help tooltip to "Press CTRL+Space to use File Template Tag to read the private key directly from a file". What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.