mirror of
https://github.com/lejianwen/rustdesk-api.git
synced 2025-12-01 01:23:15 +00:00
* fix: redirects after oauth can potentially misalign with server's actually hostname * feat: remove `RedirectURL` from oauth config, as it should checked by provider rather than client * feat: align oauth endpoint with the hostname in requests
45 lines
1.2 KiB
Go
45 lines
1.2 KiB
Go
package admin
|
|
|
|
import (
|
|
"github.com/lejianwen/rustdesk-api/v2/model"
|
|
)
|
|
|
|
type BindOauthForm struct {
|
|
Op string `json:"op" binding:"required"`
|
|
}
|
|
|
|
type OauthConfirmForm struct {
|
|
Code string `json:"code" binding:"required"`
|
|
}
|
|
type UnBindOauthForm struct {
|
|
Op string `json:"op" binding:"required"`
|
|
}
|
|
type OauthForm struct {
|
|
Id uint `json:"id"`
|
|
Op string `json:"op" validate:"omitempty"`
|
|
OauthType string `json:"oauth_type" validate:"required"`
|
|
Issuer string `json:"issuer" validate:"omitempty,url"`
|
|
Scopes string `json:"scopes" validate:"omitempty"`
|
|
ClientId string `json:"client_id" validate:"required"`
|
|
ClientSecret string `json:"client_secret" validate:"required"`
|
|
AutoRegister *bool `json:"auto_register"`
|
|
PkceEnable *bool `json:"pkce_enable"`
|
|
PkceMethod string `json:"pkce_method"`
|
|
}
|
|
|
|
func (of *OauthForm) ToOauth() *model.Oauth {
|
|
oa := &model.Oauth{
|
|
Op: of.Op,
|
|
OauthType: of.OauthType,
|
|
ClientId: of.ClientId,
|
|
ClientSecret: of.ClientSecret,
|
|
AutoRegister: of.AutoRegister,
|
|
Issuer: of.Issuer,
|
|
Scopes: of.Scopes,
|
|
PkceEnable: of.PkceEnable,
|
|
PkceMethod: of.PkceMethod,
|
|
}
|
|
oa.Id = of.Id
|
|
return oa
|
|
}
|