Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions pkg/auth/authenticator/password/denypassword/denypassword.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package denypassword

import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/auth/user"
"github.com/openshift/origin/pkg/auth/authenticator"
)

// denyPasswordAuthenticator denies all password requests
type denyPasswordAuthenticator struct {
}

// New creates a new password authenticator that denies any login attempt
func New() authenticator.Password {
return &denyPasswordAuthenticator{}
}

// AuthenticatePassword denies any login attempt
func (a denyPasswordAuthenticator) AuthenticatePassword(username, password string) (user.Info, bool, error) {
return nil, false, nil
}
6 changes: 6 additions & 0 deletions pkg/cmd/server/origin/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/openshift/origin/pkg/auth/authenticator/challenger/passwordchallenger"
"github.com/openshift/origin/pkg/auth/authenticator/password/allowanypassword"
"github.com/openshift/origin/pkg/auth/authenticator/password/basicauthpassword"
"github.com/openshift/origin/pkg/auth/authenticator/password/denypassword"
"github.com/openshift/origin/pkg/auth/authenticator/request/basicauthrequest"
"github.com/openshift/origin/pkg/auth/authenticator/request/bearertoken"
"github.com/openshift/origin/pkg/auth/authenticator/request/headerrequest"
Expand Down Expand Up @@ -126,6 +127,8 @@ const (
PasswordAuthAnyPassword PasswordAuthType = "anypassword"
// PasswordAuthBasicAuthURL validates password credentials by making a request to a remote url using basic auth. See basicauthpassword.Authenticator
PasswordAuthBasicAuthURL PasswordAuthType = "basicauthurl"
// PasswordAuthDeny treats any username and password combination as an unsuccessful authentication
PasswordAuthDeny PasswordAuthType = "deny"
)

type TokenStoreType string
Expand Down Expand Up @@ -473,6 +476,9 @@ func (c *AuthConfig) getPasswordAuthenticator() authenticator.Password {
case PasswordAuthAnyPassword:
// Accepts any username and password
passwordAuth = allowanypassword.New(identityMapper)
case PasswordAuthDeny:
// Deny any username and password
passwordAuth = denypassword.New()
default:
glog.Fatalf("No password auth found that matches %v. The oauth server cannot start!", passwordAuthType)
}
Expand Down