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