Skip to content

Switch to code authorization flow #45

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

Merged
merged 1 commit into from
Apr 24, 2017
Merged

Switch to code authorization flow #45

merged 1 commit into from
Apr 24, 2017

Conversation

liggitt
Copy link
Contributor

@liggitt liggitt commented Apr 23, 2017

Switches to code authorization flow to avoid OAuth redirects containing access tokens.

Lays the groundwork for adding PKCE support to the web console.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1430456

@liggitt
Copy link
Contributor Author

liggitt commented Apr 23, 2017

@spadgett @jwforres PTAL

Copy link
Member

@spadgett spadgett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just two small comments

// Handle an error response from the OAuth server
if (params.error) {
var error_description = params.error_description;
var error_uri = params.error_uri;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nit, but it's odd to have local vars for these two and not params.error. Also I generally avoid var declarations inside an if since they're not block scope. Suggest using params.error_description without the local vars.

then: stateData.then,
verified: stateData.verified
});
return deferred.promise;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be

if (params.access_token) {
  return $q.when({
    token: params.access_token,
    ...
  });
}

@liggitt
Copy link
Contributor Author

liggitt commented Apr 24, 2017

updated

@@ -2893,7 +2908,37 @@ angular.module('openshiftCommonServices')
// Returns a promise that resolves with {token:'...',then:'...',verified:true|false}, or rejects with {error:'...'[,error_description:'...',error_uri:'...']}
// If no token and no error is present, resolves with {}
// Example error codes: https://tools.ietf.org/html/rfc6749#section-5.2
finish: function() {
finish: function($http) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree it's gorpy to require this here... @spadgett was looking into avoiding this

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

Successfully merging this pull request may close these issues.

3 participants