samlify icon indicating copy to clipboard operation
samlify copied to clipboard

allow sp relayState to be overridden in login request

Open marcobaldo opened this issue 2 months ago • 0 comments

Addresses https://github.com/tngan/samlify/issues/163.

The changes allow you to override at the createLoginRequest call, while keeping the original relayState at the sp level as the default. This also turns the 3rd param into an options object, with tests and docs (for tag replacement) updated, while maintaining backwards compatibility.

// both valid
const { id, context } = sp.createLoginRequest(idp, "redirect", {
	customTagReplacement: (loginRequestTemplate) => {...},
	relayState: 'override relay state',
});
const { id, context } = sp.createLoginRequest(idp, "redirect", (loginRequestTemplate) => {...});

marcobaldo avatar Oct 23 '25 18:10 marcobaldo