-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Feat: Add Codefresh OIDC provider (#2) Signed-off-by: Ilia Medvedev <[email protected]> * linting and licensing fixes Signed-off-by: Ilia Medvedev <[email protected]> * fix linting warnings Signed-off-by: Ilia Medvedev <[email protected]> * fix last linting warnings Signed-off-by: Ilia Medvedev <[email protected]> * Change Run incovation URI extension to pipeline_id Signed-off-by: Ilia Medvedev <[email protected]> * add comment explaining the usage of worklow url as buildsigner Signed-off-by: Ilia Medvedev <[email protected]> * fix linting Signed-off-by: Ilia Medvedev <[email protected]> --------- Signed-off-by: Ilia Medvedev <[email protected]>
- Loading branch information
1 parent
84d6136
commit 60bf68a
Showing
12 changed files
with
827 additions
and
32 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Copyright 2023 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. | ||
|
||
url: https://oidc.codefresh.io | ||
contact: [email protected] | ||
description: "Codefresh OIDC tokens for job identity" | ||
type: "codefresh-workflow" |
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,40 @@ | ||
// Copyright 2023 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 codefresh | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/sigstore/fulcio/pkg/config" | ||
"github.com/sigstore/fulcio/pkg/identity" | ||
"github.com/sigstore/fulcio/pkg/identity/base" | ||
) | ||
|
||
type codefreshIssuer struct { | ||
identity.Issuer | ||
} | ||
|
||
func Issuer(issuerURL string) identity.Issuer { | ||
return &codefreshIssuer{base.Issuer(issuerURL)} | ||
} | ||
|
||
func (e *codefreshIssuer) Authenticate(ctx context.Context, token string, opts ...config.InsecureOIDCConfigOption) (identity.Principal, error) { | ||
idtoken, err := identity.Authorize(ctx, token, opts...) | ||
if err != nil { | ||
return nil, fmt.Errorf("authorizing codefresh issuer: %w", err) | ||
} | ||
return WorkflowPrincipalFromIDToken(ctx, idtoken) | ||
} |
Oops, something went wrong.