-
Notifications
You must be signed in to change notification settings - Fork 139
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
CiProvider as a new OIDCIssuer type #1679
Merged
haydentherapper
merged 47 commits into
sigstore:main
from
javanlacerda:javan.oidc-provider-yaml
Jul 9, 2024
Merged
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
486397e
drafting generic issuer implementation
javanlacerda f74f6a6
adding license o yaml file
javanlacerda cc5a602
remove yaml2.0
javanlacerda 9c2c0f8
start removing IssuerType usage
javanlacerda 1261f88
update license year
javanlacerda 73c988c
log
javanlacerda be6acf8
adding ci provider flag
javanlacerda ee93df8
removing drafting logic for generic principal, to be done in another pr
javanlacerda f7cd58a
fixes
javanlacerda ba9e42e
generate config
javanlacerda e0e6c53
set ci provider as a new type instead of a flag
javanlacerda 4930187
rollback isserToChallengeC
javanlacerda cafe1db
change module name to ci_provider
javanlacerda c365153
remove IsCiProvider from test
javanlacerda 39bdc22
removing underscore
javanlacerda af67958
logging
javanlacerda 3c66a3a
implementing ci provider principal logic and test for Name function
javanlacerda 2cbe6da
moving embed logic to embed function and test
javanlacerda aa257ed
adding test for ci provider WorkflowPrincipalFromIDToken
javanlacerda 4a86f57
adding test issuer for ci provider
javanlacerda 342f8ad
change providers config file name
javanlacerda 2b1ea3f
refactoring
javanlacerda c50cd30
comment applyTemplate
javanlacerda cedc9cf
removing github for now, we should add it futher for rollouting
javanlacerda 31f8e11
Adding option to check the required claim exist
javanlacerda 8eff532
omit subytype for json
javanlacerda b480032
rename issuers metadata
javanlacerda 6558b31
update the templates data order to prioritize default data over claim…
javanlacerda 5c7ee85
adding error handling for applyTemplateOrReplace
javanlacerda 54c4e6d
fixes and refactoring
javanlacerda 8f54c6a
set token.issuer as extension issuer
javanlacerda a35b6cc
remove load for providers, merge with fulcio config
javanlacerda 66a07a0
remove providers config file
javanlacerda e7cd08f
adding check for parsing templates
javanlacerda 13e7059
remove structs usage, using mapstructure instead
javanlacerda 397eee3
renamme IssuerMetadata
javanlacerda 04ef3c7
update SubjectAlternativeNameTemplate comment
javanlacerda 96a6663
several fixes
javanlacerda 611d5c4
update for using reflect instead of mapstructure
javanlacerda 1a481eb
adding test for ciprovider API
javanlacerda 8ab3f2a
adding json tags for Extensions
javanlacerda 31f0318
adding CIIssuerMetadata json and yaml mapping
javanlacerda b9cc94e
fixes
javanlacerda 42f803c
adding test for applyTemplateOrReplace
javanlacerda 478c37a
omit CIIIssuerMetadata
javanlacerda 7455b87
adding tests case for ApplyTemplateOrReplace
javanlacerda e248f43
update code for using Elem() instead of indirect
javanlacerda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2024 The Sigstore Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package ciprovider | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/sigstore/fulcio/pkg/config" | ||
"github.com/sigstore/fulcio/pkg/identity" | ||
"github.com/sigstore/fulcio/pkg/identity/base" | ||
) | ||
|
||
type ciProviderIssuer struct { | ||
identity.Issuer | ||
} | ||
|
||
func Issuer(issuerURL string) identity.Issuer { | ||
return &ciProviderIssuer{base.Issuer(issuerURL)} | ||
} | ||
|
||
func (e *ciProviderIssuer) Authenticate(ctx context.Context, token string, opts ...config.InsecureOIDCConfigOption) (identity.Principal, error) { | ||
idtoken, err := identity.Authorize(ctx, token, opts...) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return WorkflowPrincipalFromIDToken(ctx, idtoken) | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you want to test for a valid SAN template as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep! just did. thanks!!