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

add regex replace support to ClaimTemplate #35

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

LeoQuote
Copy link

@LeoQuote LeoQuote commented Dec 25, 2023

Add regex replace support in claim template, introducing more possibility to claims, like extract repo and org name from it

fix #34

This could be a good supplement for #6 , allowing users to replace and recreate claims using existing environments.

Known issues, I'm still figuring out how to fix:

  • 1. I dont know what should I do to make regex optional, since the signature of the ClaimTemplate Constructor is fixed and cannot create a second constructor
  • 2. The default value did not show in the settings box.

Any suggestions are welcomed!

Testing done

  • unit test has been added
  • tried using the plugin in my jenkins
    图片

it can replace the claim correctly, presenting jwt like

{
  "iss": "https://sa-jenkins.intra.xxx.com/oidc",
  "exp": 1703501635,
  "iat": 1703498035,
  "sub": "https://sa-jenkins.intra.xxx.com/",
  "build_number": 5,
  "org": "SA",
  "repo": "opa-policies"
}

it can fulfill my requirements.

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@LeoQuote LeoQuote marked this pull request as ready for review December 26, 2023 10:49
@LeoQuote LeoQuote requested a review from a team as a code owner December 26, 2023 10:49
@LeoQuote
Copy link
Author

图片

this feature make it possible for the handler to know this pr is from a pull request or not

@pserranoa
Copy link

+1 good feature to manage authentication with bakends

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 regex match and replace in claim template
2 participants