Skip to content

Commit 7342c97

Browse files
authored
mark principal and issuer class under pkg/identity as deprecated (#1980)
* mark principal and issuer class under pkg/identity as deprecated Signed-off-by: Sujal Gupta <[email protected]> * fix deprecation warnings Signed-off-by: Sujal Gupta <[email protected]> * ignore lint errors Signed-off-by: Sujal Gupta <[email protected]> --------- Signed-off-by: Sujal Gupta <[email protected]>
1 parent 711200d commit 7342c97

File tree

11 files changed

+24
-8
lines changed

11 files changed

+24
-8
lines changed

pkg/challenges/challenges.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ func PrincipalFromIDToken(ctx context.Context, tok *oidc.IDToken) (identity.Prin
6767
var err error
6868
switch iss.Type {
6969
case config.IssuerTypeBuildkiteJob:
70-
principal, err = buildkite.JobPrincipalFromIDToken(ctx, tok)
70+
principal, err = buildkite.JobPrincipalFromIDToken(ctx, tok) // nolint
7171
case config.IssuerTypeGitLabPipeline:
72-
principal, err = gitlabcom.JobPrincipalFromIDToken(ctx, tok)
72+
principal, err = gitlabcom.JobPrincipalFromIDToken(ctx, tok) // nolint
7373
case config.IssuerTypeEmail:
7474
principal, err = email.PrincipalFromIDToken(ctx, tok)
7575
case config.IssuerTypeSpiffe:
7676
principal, err = spiffe.PrincipalFromIDToken(ctx, tok)
7777
case config.IssuerTypeGithubWorkflow:
78-
principal, err = github.WorkflowPrincipalFromIDToken(ctx, tok)
78+
principal, err = github.WorkflowPrincipalFromIDToken(ctx, tok) // nolint
7979
case config.IssuerTypeKubernetes:
8080
principal, err = kubernetes.PrincipalFromIDToken(ctx, tok)
8181
case config.IssuerTypeURI:

pkg/identity/buildkite/issuer.go

+2
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ import (
2222
"github.com/sigstore/fulcio/pkg/identity/base"
2323
)
2424

25+
// Deprecated: Use ciprovider.ciProviderIssuer instead
2526
type buildkiteIssuer struct {
2627
identity.Issuer
2728
}
2829

30+
// Deprecated: Use ciprovider.Issuer instead
2931
func Issuer(issuerURL string) identity.Issuer {
3032
return &buildkiteIssuer{base.Issuer(issuerURL)}
3133
}

pkg/identity/buildkite/principal.go

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/sigstore/fulcio/pkg/identity"
2727
)
2828

29+
// Deprecated: Use ciprovider.ciPrincipal instead
2930
type jobPrincipal struct {
3031
// Subject matches the 'sub' claim from the OIDC ID token this is what is
3132
// signed as proof of possession for Buildkite job identities
@@ -40,6 +41,7 @@ type jobPrincipal struct {
4041
url string
4142
}
4243

44+
// Deprecated: Use ciprovider.WorkflowPrincipalFromIDToken instead
4345
func JobPrincipalFromIDToken(_ context.Context, token *oidc.IDToken) (identity.Principal, error) {
4446
var claims struct {
4547
OrganizationSlug string `json:"organization_slug"`

pkg/identity/codefresh/issuer.go

+2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ import (
2323
"github.com/sigstore/fulcio/pkg/identity/base"
2424
)
2525

26+
// Deprecated: Use ciprovider.ciProviderIssuer instead
2627
type codefreshIssuer struct {
2728
identity.Issuer
2829
}
2930

31+
// Deprecated: Use ciprovider.Issuer instead
3032
func Issuer(issuerURL string) identity.Issuer {
3133
return &codefreshIssuer{base.Issuer(issuerURL)}
3234
}

pkg/identity/codefresh/principal.go

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const (
3030
DefaultPlatformURL string = "https://g.codefresh.io"
3131
)
3232

33+
// Deprecated: Use ciprovider.ciPrincipal instead
3334
type workflowPrincipal struct {
3435
// Subject matches the 'sub' claim from the OIDC ID token this is what is signed as proof of possession for Codefresh workflow identities
3536
subject string
@@ -79,6 +80,7 @@ func (w workflowPrincipal) Name(_ context.Context) string {
7980
return w.subject
8081
}
8182

83+
// Deprecated: Use ciprovider.WorkflowPrincipalFromIDToken instead
8284
func WorkflowPrincipalFromIDToken(_ context.Context, token *oidc.IDToken) (identity.Principal, error) {
8385
var claims struct {
8486
AccountID string `json:"account_id"`

pkg/identity/github/issuer.go

+2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ import (
2323
"github.com/sigstore/fulcio/pkg/identity/base"
2424
)
2525

26+
// Deprecated: Use ciprovider.ciProviderIssuer instead
2627
type githubIssuer struct {
2728
identity.Issuer
2829
}
2930

31+
// Deprecated: Use ciprovider.Issuer instead
3032
func Issuer(issuerURL string) identity.Issuer {
3133
return &githubIssuer{base.Issuer(issuerURL)}
3234
}

pkg/identity/github/principal.go

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"github.com/sigstore/fulcio/pkg/identity"
2626
)
2727

28+
// Deprecated: Use ciprovider.ciPrincipal instead
2829
type workflowPrincipal struct {
2930
// Subject matches the 'sub' claim from the OIDC ID token this is what is
3031
// signed as proof of possession for Github workflow identities
@@ -87,6 +88,7 @@ type workflowPrincipal struct {
8788
runAttempt string
8889
}
8990

91+
// Deprecated: Use ciprovider.WorkflowPrincipalFromIDToken instead
9092
func WorkflowPrincipalFromIDToken(_ context.Context, token *oidc.IDToken) (identity.Principal, error) {
9193
var claims struct {
9294
JobWorkflowRef string `json:"job_workflow_ref"`

pkg/identity/gitlabcom/issuer.go

+2
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ import (
2222
"github.com/sigstore/fulcio/pkg/identity/base"
2323
)
2424

25+
// Deprecated: Use ciprovider.ciProviderIssuer instead
2526
type gitlabIssuer struct {
2627
identity.Issuer
2728
}
2829

30+
// Deprecated: Use ciprovider.Issuer instead
2931
func Issuer(issuerURL string) identity.Issuer {
3032
return &gitlabIssuer{base.Issuer(issuerURL)}
3133
}

pkg/identity/gitlabcom/principal.go

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/sigstore/fulcio/pkg/identity"
2727
)
2828

29+
// Deprecated: Use ciprovider.ciPrincipal instead
2930
type jobPrincipal struct {
3031
// Subject matches the 'sub' claim from the OIDC ID token this is what is
3132
// signed as proof of possession for Buildkite job identities
@@ -82,6 +83,7 @@ type jobPrincipal struct {
8283
projectVisibility string
8384
}
8485

86+
// Deprecated: Use ciprovider.WorkflowPrincipalFromIDToken instead
8587
func JobPrincipalFromIDToken(_ context.Context, token *oidc.IDToken) (identity.Principal, error) {
8688
var claims struct {
8789
ProjectPath string `json:"project_path"`

pkg/server/issuer_pool.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ func getIssuer(meta string, i config.OIDCIssuer) identity.Issuer {
5757
case config.IssuerTypeEmail:
5858
return email.Issuer(issuerURL)
5959
case config.IssuerTypeGithubWorkflow:
60-
return github.Issuer(issuerURL)
60+
return github.Issuer(issuerURL) // nolint
6161
case config.IssuerTypeCIProvider:
6262
return ciprovider.Issuer(issuerURL)
6363
case config.IssuerTypeGitLabPipeline:
64-
return gitlabcom.Issuer(issuerURL)
64+
return gitlabcom.Issuer(issuerURL) // nolint
6565
case config.IssuerTypeBuildkiteJob:
66-
return buildkite.Issuer(issuerURL)
66+
return buildkite.Issuer(issuerURL) // nolint
6767
case config.IssuerTypeCodefreshWorkflow:
68-
return codefresh.Issuer(issuerURL)
68+
return codefresh.Issuer(issuerURL) // nolint
6969
case config.IssuerTypeChainguard:
7070
return chainguard.Issuer(issuerURL)
7171
case config.IssuerTypeKubernetes:

pkg/server/issuer_pool_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func TestGetIssuer(t *testing.T) {
9292
IssuerURL: "github.com",
9393
Type: "github-workflow",
9494
},
95-
expected: github.Issuer("github.com"),
95+
expected: github.Issuer("github.com"), // nolint
9696
}, {
9797
description: "spiffe",
9898
issuer: config.OIDCIssuer{

0 commit comments

Comments
 (0)