[#2762] added Yandex OAuth2 provider

Co-authored-by: Valentine <xb2w1z@gmail.com>
This commit is contained in:
Gani Georgiev
2023-06-23 14:13:43 +03:00
parent 0a61db6efd
commit 435eca6f35
39 changed files with 152 additions and 37 deletions

View File

@@ -62,6 +62,7 @@ type Settings struct {
AppleAuth AuthProviderConfig `form:"appleAuth" json:"appleAuth"`
InstagramAuth AuthProviderConfig `form:"instagramAuth" json:"instagramAuth"`
VKAuth AuthProviderConfig `form:"vkAuth" json:"vkAuth"`
YandexAuth AuthProviderConfig `form:"yandexAuth" json:"yandexAuth"`
}
// New creates and returns a new default Settings instance.
@@ -183,6 +184,9 @@ func New() *Settings {
VKAuth: AuthProviderConfig{
Enabled: false,
},
YandexAuth: AuthProviderConfig{
Enabled: false,
},
}
}
@@ -225,6 +229,7 @@ func (s *Settings) Validate() error {
validation.Field(&s.AppleAuth),
validation.Field(&s.InstagramAuth),
validation.Field(&s.VKAuth),
validation.Field(&s.YandexAuth),
)
}
@@ -290,6 +295,7 @@ func (s *Settings) RedactClone() (*Settings, error) {
&clone.AppleAuth.ClientSecret,
&clone.InstagramAuth.ClientSecret,
&clone.VKAuth.ClientSecret,
&clone.YandexAuth.ClientSecret,
}
// mask all sensitive fields
@@ -329,6 +335,7 @@ func (s *Settings) NamedAuthProviderConfigs() map[string]AuthProviderConfig {
auth.NameApple: s.AppleAuth,
auth.NameInstagram: s.InstagramAuth,
auth.NameVK: s.VKAuth,
auth.NameYandex: s.YandexAuth,
}
}