代码拉取完成,页面将自动刷新
package oauth2
// ServerOptions server可选参数列表
type ServerOptions struct {
Log Logger
Issuer string
DeviceAuthorizationEndpointEnabled bool // https://tools.ietf.org/html/rfc8628
DeviceVerificationURI string // https://tools.ietf.org/html/rfc8628#section-3.2
IntrospectEndpointEnabled bool // https://tools.ietf.org/html/rfc7662
TokenRevocationEnabled bool // https://tools.ietf.org/html/rfc7009
CustomGrantTypeEnabled bool // 自定义身份验证
CustomGrantTypeAuthentication map[string]CustomGrantTypeAuthenticationFunc
}
// ServerOption 为可选参数赋值的函数
type ServerOption func(*ServerOptions)
// ServerLogger ...
func ServerLogger(log Logger) ServerOption {
return func(o *ServerOptions) {
o.Log = log
}
}
// ServerIssuer ...
func ServerIssuer(issuer string) ServerOption {
return func(o *ServerOptions) {
o.Issuer = issuer
}
}
// ServerDeviceAuthorizationEndpointEnabled ...
func ServerDeviceAuthorizationEndpointEnabled(deviceAuthorizationEndpointEnabled bool) ServerOption {
return func(o *ServerOptions) {
o.DeviceAuthorizationEndpointEnabled = deviceAuthorizationEndpointEnabled
}
}
// ServerDeviceVerificationURI ...
func ServerDeviceVerificationURI(deviceVerificationURI string) ServerOption {
return func(o *ServerOptions) {
o.DeviceVerificationURI = deviceVerificationURI
}
}
// ServerIntrospectEndpointEnabled ...
func ServerIntrospectEndpointEnabled(introspectEndpointEnabled bool) ServerOption {
return func(o *ServerOptions) {
o.IntrospectEndpointEnabled = introspectEndpointEnabled
}
}
// ServerTokenRevocationEnabled ...
func ServerTokenRevocationEnabled(tokenRevocationEnabled bool) ServerOption {
return func(o *ServerOptions) {
o.TokenRevocationEnabled = tokenRevocationEnabled
}
}
// ServerCustomGrantTypeEnabled ...
func ServerCustomGrantTypeEnabled(customGrantTypeEnabled bool) ServerOption {
return func(o *ServerOptions) {
o.CustomGrantTypeEnabled = customGrantTypeEnabled
}
}
// ServerCustomGrantTypeAuthentication ...
func ServerCustomGrantTypeAuthentication(customGrantTypeAuthentication map[string]CustomGrantTypeAuthenticationFunc) ServerOption {
return func(o *ServerOptions) {
o.CustomGrantTypeAuthentication = customGrantTypeAuthentication
}
}
// newServerOptions 创建server可选参数
func newServerOptions(opts ...ServerOption) ServerOptions {
opt := ServerOptions{
Log: &DefaultLogger{},
Issuer: DefaultJwtIssuer,
DeviceAuthorizationEndpointEnabled: false,
DeviceVerificationURI: "/device",
IntrospectEndpointEnabled: false,
TokenRevocationEnabled: false,
CustomGrantTypeEnabled: false,
CustomGrantTypeAuthentication: make(map[string]CustomGrantTypeAuthenticationFunc),
}
for _, o := range opts {
o(&opt)
}
return opt
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。