Merge pull request #1554 from micro/oauth-login-hint
Add oauth login hint param
This commit is contained in:
commit
211fd9b9a3
@ -41,6 +41,10 @@ func (o *oauth) Endpoint(opts ...provider.EndpointOption) string {
|
|||||||
params.Add("state", options.State)
|
params.Add("state", options.State)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(options.LoginHint) > 0 {
|
||||||
|
params.Add("login_hint", options.LoginHint)
|
||||||
|
}
|
||||||
|
|
||||||
if clientID := o.opts.ClientID; len(clientID) > 0 {
|
if clientID := o.opts.ClientID; len(clientID) > 0 {
|
||||||
params.Add("client_id", clientID)
|
params.Add("client_id", clientID)
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,10 @@ type Grant struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type EndpointOptions struct {
|
type EndpointOptions struct {
|
||||||
|
// State is a code to verify the req
|
||||||
State string
|
State string
|
||||||
|
// LoginHint prefils the user id on oauth clients
|
||||||
|
LoginHint string
|
||||||
}
|
}
|
||||||
|
|
||||||
type EndpointOption func(*EndpointOptions)
|
type EndpointOption func(*EndpointOptions)
|
||||||
@ -38,3 +41,9 @@ func WithState(c string) EndpointOption {
|
|||||||
o.State = c
|
o.State = c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func WithLoginHint(hint string) EndpointOption {
|
||||||
|
return func(o *EndpointOptions) {
|
||||||
|
o.LoginHint = hint
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user