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

Feature: Return Raw Decrypted Assertion #167

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/saml2.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ parse_authn_response = (saml_response, sp_private_keys, idp_certificates, allow_
assertion_attributes = parse_assertion_attributes decrypted_assertion
user = _.extend user, pretty_assertion_attributes(assertion_attributes)
user = _.extend user, attributes: assertion_attributes
cb_wf null, { user }
cb_wf null, { user, decrypted_assertion }
catch err
return cb_wf err
], cb
Expand Down
15 changes: 10 additions & 5 deletions test/saml2.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,8 @@ describe 'saml2', ->
'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname': [ 'Student' ]
'http://schemas.xmlsoap.org/claims/CommonName': [ 'Test Student' ]

assert.deepEqual response, expected_response
assert.ok response.decrypted_assertion;
assert.deepEqual (_.omit response, 'decrypted_assertion'), expected_response
done()

it 'allows the signature to be embedded outside of the assertion', (done) ->
Expand Down Expand Up @@ -441,7 +442,8 @@ describe 'saml2', ->
attributes:
'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname': [ 'Test' ]

assert.deepEqual response, expected_response
assert.ok response.decrypted_assertion;
assert.deepEqual (_.omit response, 'decrypted_assertion'), expected_response
done()

it 'errors if passed invalid data', (done) ->
Expand Down Expand Up @@ -548,7 +550,8 @@ describe 'saml2', ->
session_not_on_or_after: '2016-02-11T21:12:09Z'
attributes: {}

assert.deepEqual response, expected_response
assert.ok response.decrypted_assertion;
assert.deepEqual (_.omit response, 'decrypted_assertion'), expected_response
done()

it 'correctly parses an AuthnStatement with no session_index', (done) ->
Expand Down Expand Up @@ -589,7 +592,8 @@ describe 'saml2', ->
session_not_on_or_after: '2016-02-11T21:12:09Z'
attributes: {}

assert.deepEqual response, expected_response
assert.ok response.decrypted_assertion;
assert.deepEqual (_.omit response, 'decrypted_assertion'), expected_response
done()

it 'rejects an assertion with an NotBefore condition in the future', (done) ->
Expand Down Expand Up @@ -859,7 +863,8 @@ describe 'saml2', ->
'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname': [ 'Student' ]
'http://schemas.xmlsoap.org/claims/CommonName': [ 'Test Student' ]

assert.deepEqual response, expected_response
assert.ok response.decrypted_assertion;
assert.deepEqual (_.omit response, 'decrypted_assertion'), expected_response
done()

describe 'ServiceProvider', ->
Expand Down