summaryrefslogtreecommitdiffstats
path: root/services/auth/source/oauth2/providers_base.go
blob: c8e41430ab245f8ac554c0e5ea9728686f4ed56b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright 2021 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT

package oauth2

import "code.gitea.io/gitea/modules/setting"

// 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
}

// 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"
}

// CustomURLSettings returns the custom url settings for this provider
func (b *BaseProvider) CustomURLSettings() *CustomURLSettings {
	return nil
}

var _ Provider = &BaseProvider{}