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