Skip to content

Conversation

@securityvoid
Copy link

The profile request for AzureAD requires an Auth Bearer header rather than an access_token in the URL. Since adding an extra header shouldn't ever hurt anything, updated the get call for the profile to include the access_token value in an Auth Bearer header in addition to including it on the URL.

I also updated the logic for the passing of parameters for the signin URL so that you can pass an arbitrary number of parameters over to meet the needs of any given provider. I thought this was a little more robust than just adding the "Resource" parameter by itself.

I also found the ability to add any parameter I wished to be very useful when trouble-shooting to try and figure out why my login was not behaving the same as Passport, since this would allow me to add/remove parameters from the original call.

* Adding Auth Bearer Header to profile request
* Allowing arbitrary parameters to signin request
* Adds redirect_method configuration option so you can set if the redirect with be a GET or POST
* Creates a function in the util class which generates an auto-submitting form and returns the contents.
* Extends "TokenResponse" so that rather than just returning the url, it returns the url, method, and html for auto-submitting form page.

NOTE: To use this you must also update redirectProxyCallback in the helpers.js so that it changes behavior based on this.

e.g.

const redirectProxyCallback = (context, data) => {
  if( data.method === 'POST'){
      context.succeed({
          statusCode: 200,
          headers: {
              "Content-Type" : "text/html"
          },
          body : data.form
      });
  } else {
    context.succeed({
        statusCode: 302,
        headers: {
            Location: data.url
        }
    });
  }

};
@securityvoid
Copy link
Author

FYI, looks like the fact I added URL encoding to the URL caused Travis checks to fail. I think it should in fact be okay.

@laardee laardee self-assigned this Dec 18, 2016
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.

2 participants