2021-08-06 06:41:08 +05:30
|
|
|
// Copyright 2021 The Gitea Authors. All rights reserved.
|
2022-11-27 23:50:29 +05:30
|
|
|
// SPDX-License-Identifier: MIT
|
2021-08-06 06:41:08 +05:30
|
|
|
|
|
|
|
package oauth2
|
|
|
|
|
2023-06-08 22:05:29 +05:30
|
|
|
import "code.gitea.io/gitea/modules/setting"
|
|
|
|
|
2021-08-06 06:41:08 +05:30
|
|
|
// 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 22:05:29 +05:30
|
|
|
// 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-06 06:41:08 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
// CustomURLSettings returns the custom url settings for this provider
|
|
|
|
func (b *BaseProvider) CustomURLSettings() *CustomURLSettings {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2023-06-08 22:05:29 +05:30
|
|
|
var _ Provider = &BaseProvider{}
|