Skip to content

feat!: add first-class NameIDFormat support - #9

Merged
william-suppo merged 1 commit into
4.xfrom
feat/name-id-format
Jul 7, 2026
Merged

feat!: add first-class NameIDFormat support#9
william-suppo merged 1 commit into
4.xfrom
feat/name-id-format

Conversation

@william-suppo

Copy link
Copy Markdown
Contributor

Summary

  • Expose NameIDFormat across the high-level API: IdP/SP metadata (nameIdFormats), AuthnRequest's NameIDPolicy (nameIdPolicyFormat), AuthnResponse, and LogoutRequest (send + receive)
  • Introduce Litesaml\Models\Messages\NameId (value + format) to replace the separate nameId/nameIdFormat properties, avoiding orphaned/inconsistent pairs

Breaking change

nameId is now a NameId value object instead of a plain string on AuthnResponse, LogoutRequest, and as the sendLogoutRequest() parameter:

// before
$message->nameId; // string
$sp->sendLogoutRequest($idp, 'user@example.com');

// after
$message->nameId?->value;
$message->nameId?->format;
$sp->sendLogoutRequest($idp, new NameId('user@example.com', $format));

Closes #7

Test plan

  • composer test (72/72, one pre-existing unrelated failure on master: handle_authn_response_rejects_xml_signature_wrapping_attack)
  • composer phpstan clean

@william-suppo william-suppo linked an issue Jul 7, 2026 that may be closed by this pull request
Expose the NameID Format across metadata (IdP/SP `nameIdFormats`),
AuthnRequest's NameIDPolicy, AuthnResponse, and LogoutRequest, so
applications can request, read, and reuse the format alongside the
identifier value (e.g. for SP-initiated logout).

BREAKING CHANGE: `nameId` is now a `Litesaml\Models\Messages\NameId`
value object (`value` + `format`) instead of a plain string on
`AuthnResponse`, `LogoutRequest`, and as the `sendLogoutRequest()`
parameter.

Closes #7
@william-suppo
william-suppo force-pushed the feat/name-id-format branch from 9f531a6 to 89c72fe Compare July 7, 2026 09:42
@william-suppo
william-suppo merged commit 46f6bbd into 4.x Jul 7, 2026
3 checks passed
@william-suppo
william-suppo deleted the feat/name-id-format branch July 7, 2026 09:43
william-suppo added a commit that referenced this pull request Jul 7, 2026
Expose the NameID Format across metadata (IdP/SP `nameIdFormats`),
AuthnRequest's NameIDPolicy, AuthnResponse, and LogoutRequest, so
applications can request, read, and reuse the format alongside the
identifier value (e.g. for SP-initiated logout).

BREAKING CHANGE: `nameId` is now a `Litesaml\Models\Messages\NameId`
value object (`value` + `format`) instead of a plain string on
`AuthnResponse`, `LogoutRequest`, and as the `sendLogoutRequest()`
parameter.

Closes #7
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.

Support for NameIDFormat

1 participant