Skip to content

Commit 4f41023

Browse files
committed
auth: fail authenticator creation if auth-source is unknown
1 parent d792492 commit 4f41023

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

cmd/bridge/config/auth/authoptions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ func (c *completedOptions) getAuthenticator(
240240
)
241241

242242
var scopes []string
243-
authSource := auth.AuthSourceTectonic
243+
authSource := auth.AuthSourceOIDC
244244

245245
if c.AuthType == "openshift" {
246246
scopes = []string{"user:full"}

pkg/auth/auth.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ type loginMethod interface {
102102
type AuthSource int
103103

104104
const (
105-
AuthSourceTectonic AuthSource = 0
105+
AuthSourceOIDC AuthSource = 0
106106
AuthSourceOpenShift AuthSource = 1
107107
)
108108

@@ -213,12 +213,14 @@ func NewAuthenticator(ctx context.Context, c *Config) (*Authenticator, error) {
213213
if err != nil {
214214
return nil, err
215215
}
216-
default:
216+
case AuthSourceOIDC:
217217
sessionStore := NewSessionStore(32768)
218218
tokenHandler, err = newOIDCAuth(ctx, sessionStore, authConfig)
219219
if err != nil {
220220
return nil, err
221221
}
222+
default:
223+
return nil, fmt.Errorf("unknown auth source: %v", c.AuthSource)
222224
}
223225
a.loginMethod = tokenHandler
224226

0 commit comments

Comments
 (0)