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

logoutRequestRedirectURL now replaces required and custom tags #202

Merged
merged 4 commits into from Aug 19, 2018

Conversation

franklinjjeng
Copy link
Contributor

@franklinjjeng franklinjjeng commented Aug 15, 2018

Updating logic of customReplaceTag to accept tags created by the entity.

callback function for createLogoutRequest would look like this

(template, tags) => {
  const customTags = {
     SessionIndex: ''
  }
  return customReplaceTagsByValue(template, { ...tags, ...customTags});
}

customReplaceTagsByValue being a function that returns { context, id } and can be very similar to libsaml.replaceTagsByValue

PR associated with #196

IssueInstant: new Date().toISOString(),
NameIDFormat: namespace.format[initSetting.logoutNameIDFormat] || namespace.format.emailAddress,
NameID: user.logoutNameID,
SessionIndex: user.sessionIndex,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

SessionIndex is not a required field, but it was already being added. Leaving this in here to prevent potential issues with others

Copy link
Owner

Choose a reason for hiding this comment

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

SessionIndex is not being added into the default template.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tngan you are correct. It's not being used, but looking at line 145 of the original code, it was added in there. I could remove this line, but I left it in to avoid unintended side affects.

Copy link
Owner

Choose a reason for hiding this comment

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

Interesting. Okay, let's keep it first. I am working on a big revamp as well.

@@ -214,12 +214,12 @@ test('create post login response', async t => {
});

test('create logout request with redirect binding', t => {
const { id, context } = sp.createLogoutRequest(idp, 'redirect', { email: 'user@esaml2' });
const { id, context } = sp.createLogoutRequest(idp, 'redirect', { logoutNameID: 'user@esaml2' });
Copy link
Contributor Author

Choose a reason for hiding this comment

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

NameID looks for user.logoutNameID

Copy link
Owner

Choose a reason for hiding this comment

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

Good catch !

@coveralls
Copy link

Coverage Status

Coverage increased (+0.005%) to 89.755% when pulling 0f03ffe on franklinjjeng:custom-logout into 031cafd on tngan:master.

@tngan tngan merged commit dd187be into tngan:master Aug 19, 2018
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.

None yet

3 participants