Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Security] Add security:oidc-token:generate command#60660

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@Jean-Beru
Copy link
Contributor

@Jean-BeruJean-Beru commentedJun 3, 2025
edited
Loading

QA
Branch?7.4
Bug fix?no
New feature?yes (should I create the CHANGELOG-7.4.md file?)
Deprecations?no
Issues
LicenseMIT

TheOidcTokenHandlerintroduced in Symfony 6.3, allows to decode a JWT token, validate it and retrieve the user info from it.

This pull request introduces a new Symfony command,bin/console security:oidc-token:generate, designed to facilitate the generation of JWTs. It can be useful for generating a token for testing purpose.

Argument and options

Description:  Generate an OIDC token for a given userUsage:  security:oidc-token:generate [options] [--] <user-identifier>Arguments:  user-identifier              User identifierOptions:      --firewall=FIREWALL      Firewall      --algorithm=ALGORITHM    Algorithm name to use to sign      --issuer=ISSUER          Set the Issuer claim (iss)      --ttl=TTL                Set the Expiration Time claim (exp) (time to live in seconds)      --not-before=NOT-BEFORE  Set the Not Before claim (nbf)

Usage

php bin/console security:oidc-token:generate jane.doe@example.com \  --firewall="api" \  --algorithm="HS256" \  --issuer="https://example.com" \  --ttl=7200 \  --not-before=tomorrow

Tip

When there is only one value, both "firewall", "algorithm" and "issuer" are not required..

welcoMattic, OskarStark, and Spomky reacted with heart emoji
@chalasr
Copy link
Member

Good call 👍I would make "token" or "jwt" part of the command name though as I find "oidc:generate" rather confusing (yup, no better suggestion yet 🙃).

@Jean-BeruJean-Beru changed the title[Security] Add security:oidc:generate command[Security] Add security:oidc-token:generate commandJun 6, 2025
@Jean-Beru
Copy link
ContributorAuthor

Good call 👍I would make "token" or "jwt" part of the command name though as I find "oidc:generate" rather confusing (yup, no better suggestion yet 🙃).

Sure! Not more inspired than you, I renamed it tooidc-token:generate 😅

chalasr and Spomky reacted with thumbs up emoji

Copy link
Contributor

@SpomkySpomky left a comment

Choose a reason for hiding this comment

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

That's a nice idea!
No remarks for this PR and OK with the nameoidc-token:generate.

@chalasr
Copy link
Member

Maybesecurity:oidc:generate-token would be more future-proof?

@stof
Copy link
Member

I like thesecurity:oidc:generate-token name suggested by@chalasr as it makes it possible to add more commands related tooidc in the future even for other purposes.

@Jean-Beru
Copy link
ContributorAuthor

I like thesecurity:oidc:generate-token name suggested by@chalasr as it makes it possible to add more commands related tooidc in the future even for other purposes.

OK, let's go withsecurity:oidc:generate-token 🚀

;
}


Copy link
Member

Choose a reason for hiding this comment

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

Extra new line

Suggested change

*/
class OidcTokenGeneratorTestextends TestCase
{

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

Comment on lines 27 to 28
*
* @final
Copy link
Member

Choose a reason for hiding this comment

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

Not needed as the class is already marked as final.

Suggested change
*
* @final

@fabpotfabpotforce-pushed thesecurity/generate-oidc-command branch from730512f to5c18b1aCompareOctober 6, 2025 05:55
@fabpot
Copy link
Member

Thank you@Jean-Beru.

@fabpotfabpot merged commitfd498be intosymfony:7.4Oct 6, 2025
4 of 12 checks passed
@Jean-BeruJean-Beru deleted the security/generate-oidc-command branchOctober 13, 2025 11:47
@fabpotfabpot mentioned this pull requestOct 27, 2025
@fabpotfabpot mentioned this pull requestOct 27, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof requested changes

@fabpotfabpotfabpot approved these changes

@SpomkySpomkySpomky approved these changes

@chalasrchalasrAwaiting requested review from chalasrchalasr is a code owner

Assignees

No one assigned

Projects

None yet

Milestone

7.4

Development

Successfully merging this pull request may close these issues.

6 participants

@Jean-Beru@chalasr@stof@fabpot@Spomky@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp