-
-
Notifications
You must be signed in to change notification settings - Fork 222
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
InvalidNameIDPolicy from IDP made sp.parseLoginResponse throw #279
Comments
Sorry, it was accidentally closed. |
I got the exact same error from our AD. Is there a way to define |
@csgruenebe https://samlify.js.org/#/sp-configuration Do you mean the |
@tngan ah sorry, did not see it was an array :) so it is already there :) |
@csgruenebe Can you help to open another ticket ? Then we can continue the discussion. UPDATE: That one is for metadata declaration, but you can pass |
@csgruenebe Let's continue the discussion on #284. This ticket is left for the enhancement of handling status code (failure) inside samlify. |
@marwej v2.5.1 is released to npm. The following test covers this use case. Lines 655 to 661 in 846ab75
|
I have now started to get an empty Tried to rollback to an earlier version but same error. Nothing to do with Do you recognize this? |
@marwej If the response is not succeeded, it will throw an error with the top and second tier error message before hit the line you have. The only case must be succeeded when you get the Can you show me the code how you construct the handler of SAML response ? I have already removed the |
It is a successful result (not the one above). <saml2p:Status>
<saml2p:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
</saml2p:Status> The code is basically this: const parseResult = await sp.parseLoginResponse(idp, 'post', req);
if (!isPlainObject(parseResult.extract)) throw new Error('Could not parse SAML response');
const { statusCode, nameID } = parseResult.extract;
if (!isString(statusCode)) throw new Error('No status code');
if (statusCode !== STATUS_CODES.success) throw new Error('Non-successful response'); Could I just assume the respons is successful if parsing is ok then? |
@marwej There is no try {
const parseResult = await sp.parseLoginResponse(idp, 'post', req);
console.log(parseResult.extract); // if this line hits, indicating that the status is success
} catch (e) {
console.error(e);
} |
Roger that. Thanks for a great package! |
I got this in a response from IdP (AD FS):
It took me a long time to realize because
const parseResult = await sp.parseLoginResponse(idp, 'post', req);
threw an errorERR_EMPTY_ASSERTION
(https://github.com/tngan/samlify/blob/master/src/flow.ts#L36).Would it be possible to return a parsed response in these cases too (with correct status code)?
The text was updated successfully, but these errors were encountered: