1
0
mirror of https://github.com/oauth2-proxy/oauth2-proxy.git synced 2025-06-04 23:37:29 +02:00

Remove GetPreferredUsername method from Provider interface

It isn't used in any providers and we have future plans
to remove the specialness of PreferredUsername and make it
an optional field in the session.

User, Email & Groups will eventually be the only first class
fields on the session that are always set.
This commit is contained in:
Nick Meves 2020-09-23 15:55:22 -07:00
parent 160685abd7
commit 3371284a36
No known key found for this signature in database
GPG Key ID: 93BA8A3CEDCDD1CF
3 changed files with 0 additions and 13 deletions

View File

@ -310,13 +310,6 @@ func (p *OAuthProxy) redeemCode(ctx context.Context, host, code string) (s *sess
s.Email, err = p.provider.GetEmailAddress(ctx, s)
}
if s.PreferredUsername == "" {
s.PreferredUsername, err = p.provider.GetPreferredUsername(ctx, s)
if err != nil && err.Error() == "not implemented" {
err = nil
}
}
if s.User == "" {
s.User, err = p.provider.GetUserName(ctx, s)
if err != nil && err.Error() == "not implemented" {

View File

@ -104,11 +104,6 @@ func (p *ProviderData) GetUserName(ctx context.Context, s *sessions.SessionState
return "", errors.New("not implemented")
}
// GetPreferredUsername returns the Account preferred username
func (p *ProviderData) GetPreferredUsername(ctx context.Context, s *sessions.SessionState) (string, error) {
return "", errors.New("not implemented")
}
// ValidateGroup validates that the provided email exists in the configured provider
// email group(s).
func (p *ProviderData) ValidateGroup(email string) bool {

View File

@ -12,7 +12,6 @@ type Provider interface {
Data() *ProviderData
GetEmailAddress(ctx context.Context, s *sessions.SessionState) (string, error)
GetUserName(ctx context.Context, s *sessions.SessionState) (string, error)
GetPreferredUsername(ctx context.Context, s *sessions.SessionState) (string, error)
Redeem(ctx context.Context, redirectURI, code string) (*sessions.SessionState, error)
ValidateGroup(string) bool
ValidateSessionState(ctx context.Context, s *sessions.SessionState) bool