2021-08-05 20:11:08 -05:00
|
|
|
// Copyright 2021 The Gitea Authors. All rights reserved.
|
2022-11-27 13:20:29 -05:00
|
|
|
// SPDX-License-Identifier: MIT
|
2021-08-05 20:11:08 -05:00
|
|
|
|
|
|
|
package oauth2
|
|
|
|
|
2023-06-08 11:35:29 -05:00
|
|
|
import "code.gitea.io/gitea/modules/setting"
|
|
|
|
|
2021-08-05 20:11:08 -05:00
|
|
|
// BaseProvider represents a common base for Provider
|
|
|
|
type BaseProvider struct {
|
|
|
|
name string
|
|
|
|
displayName string
|
|
|
|
}
|
|
|
|
|
|
|
|
// Name provides the technical name for this provider
|
|
|
|
func (b *BaseProvider) Name() string {
|
|
|
|
return b.name
|
|
|
|
}
|
|
|
|
|
|
|
|
// DisplayName returns the friendly name for this provider
|
|
|
|
func (b *BaseProvider) DisplayName() string {
|
|
|
|
return b.displayName
|
|
|
|
}
|
|
|
|
|
2023-06-08 11:35:29 -05:00
|
|
|
// IconURL returns an icon path for this provider
|
|
|
|
// Use svg for default icons, providers_openid has its own IconURL function
|
|
|
|
func (b *BaseProvider) IconURL() string {
|
|
|
|
name := b.name
|
|
|
|
if b.name == "gplus" {
|
|
|
|
name = "google"
|
|
|
|
}
|
|
|
|
return setting.AppSubURL + "/assets/img/auth/" + name + ".svg"
|
2021-08-05 20:11:08 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// CustomURLSettings returns the custom url settings for this provider
|
|
|
|
func (b *BaseProvider) CustomURLSettings() *CustomURLSettings {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2023-06-08 11:35:29 -05:00
|
|
|
var _ Provider = &BaseProvider{}
|