You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
OneAuth/api/oauth/providers/templates.go

33 lines
753 B
Go

//
// Copyright (C) 2024 veypi <i@veypi.com>
// 2025-03-04 16:08:06
// Distributed under terms of the MIT license.
//
package providers
import (
"github.com/veypi/vbase/models"
"github.com/veypi/vigo"
)
// TemplatesResponse 模板响应
type TemplatesResponse struct {
Templates []models.OAuthProvider `json:"templates"`
}
// templates 获取内置 OAuth 模板
func templates(x *vigo.X) (*TemplatesResponse, error) {
// 返回内置模板(清除敏感信息)
templates := make([]models.OAuthProvider, len(models.OAuthProviderTemplates))
for i, tpl := range models.OAuthProviderTemplates {
templates[i] = tpl
templates[i].ClientID = ""
templates[i].ClientSecret = ""
}
return &TemplatesResponse{
Templates: templates,
}, nil
}