feat: add configuration support for back channel logout
This commit is contained in:
parent
3b64e792ed
commit
1a0238155c
5 changed files with 64 additions and 10 deletions
|
@ -145,6 +145,14 @@ type DiscoveryConfiguration struct {
|
|||
|
||||
// OPTermsOfServiceURI is a URL the OpenID Provider provides to the person registering the Client to read about OpenID Provider's terms of service.
|
||||
OPTermsOfServiceURI string `json:"op_tos_uri,omitempty"`
|
||||
|
||||
// BackChannelLogoutSupported specifies whether the OP supports back-channel logout (https://openid.net/specs/openid-connect-backchannel-1_0.html),
|
||||
// with true indicating support. If omitted, the default value is false.
|
||||
BackChannelLogoutSupported bool `json:"backchannel_logout_supported,omitempty"`
|
||||
|
||||
// BackChannelLogoutSessionSupported specifies whether the OP can pass a sid (session ID) Claim in the Logout Token to identify the RP session with the OP.
|
||||
// If supported, the sid Claim is also included in ID Tokens issued by the OP. If omitted, the default value is false.
|
||||
BackChannelLogoutSessionSupported bool `json:"backchannel_logout_session_supported,omitempty"`
|
||||
}
|
||||
|
||||
type AuthMethod string
|
||||
|
|
|
@ -51,6 +51,11 @@ type Client interface {
|
|||
ClockSkew() time.Duration
|
||||
}
|
||||
|
||||
type ClientBackChannelLogout interface {
|
||||
Client
|
||||
BackChannelLogoutURI() string
|
||||
}
|
||||
|
||||
// HasRedirectGlobs is an optional interface that can be implemented by implementors of
|
||||
// Client. See https://pkg.go.dev/path#Match for glob
|
||||
// interpretation. Redirect URIs that match either the non-glob version or the
|
||||
|
|
|
@ -49,6 +49,9 @@ type Configuration interface {
|
|||
|
||||
SupportedUILocales() []language.Tag
|
||||
DeviceAuthorization() DeviceAuthorizationConfig
|
||||
|
||||
BackChannelLogoutSupported() bool
|
||||
BackChannelLogoutSessionSupported() bool
|
||||
}
|
||||
|
||||
type IssuerFromRequest func(r *http.Request) string
|
||||
|
|
|
@ -78,6 +78,34 @@ func (mr *MockConfigurationMockRecorder) AuthorizationEndpoint() *gomock.Call {
|
|||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AuthorizationEndpoint", reflect.TypeOf((*MockConfiguration)(nil).AuthorizationEndpoint))
|
||||
}
|
||||
|
||||
// BackChannelLogoutSessionSupported mocks base method.
|
||||
func (m *MockConfiguration) BackChannelLogoutSessionSupported() bool {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "BackChannelLogoutSessionSupported")
|
||||
ret0, _ := ret[0].(bool)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// BackChannelLogoutSessionSupported indicates an expected call of BackChannelLogoutSessionSupported.
|
||||
func (mr *MockConfigurationMockRecorder) BackChannelLogoutSessionSupported() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BackChannelLogoutSessionSupported", reflect.TypeOf((*MockConfiguration)(nil).BackChannelLogoutSessionSupported))
|
||||
}
|
||||
|
||||
// BackChannelLogoutSupported mocks base method.
|
||||
func (m *MockConfiguration) BackChannelLogoutSupported() bool {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "BackChannelLogoutSupported")
|
||||
ret0, _ := ret[0].(bool)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// BackChannelLogoutSupported indicates an expected call of BackChannelLogoutSupported.
|
||||
func (mr *MockConfigurationMockRecorder) BackChannelLogoutSupported() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BackChannelLogoutSupported", reflect.TypeOf((*MockConfiguration)(nil).BackChannelLogoutSupported))
|
||||
}
|
||||
|
||||
// CodeMethodS256Supported mocks base method.
|
||||
func (m *MockConfiguration) CodeMethodS256Supported() bool {
|
||||
m.ctrl.T.Helper()
|
||||
|
|
30
pkg/op/op.go
30
pkg/op/op.go
|
@ -158,16 +158,18 @@ func authCallbackPath(o OpenIDProvider) string {
|
|||
}
|
||||
|
||||
type Config struct {
|
||||
CryptoKey [32]byte
|
||||
DefaultLogoutRedirectURI string
|
||||
CodeMethodS256 bool
|
||||
AuthMethodPost bool
|
||||
AuthMethodPrivateKeyJWT bool
|
||||
GrantTypeRefreshToken bool
|
||||
RequestObjectSupported bool
|
||||
SupportedUILocales []language.Tag
|
||||
SupportedClaims []string
|
||||
DeviceAuthorization DeviceAuthorizationConfig
|
||||
CryptoKey [32]byte
|
||||
DefaultLogoutRedirectURI string
|
||||
CodeMethodS256 bool
|
||||
AuthMethodPost bool
|
||||
AuthMethodPrivateKeyJWT bool
|
||||
GrantTypeRefreshToken bool
|
||||
RequestObjectSupported bool
|
||||
SupportedUILocales []language.Tag
|
||||
SupportedClaims []string
|
||||
DeviceAuthorization DeviceAuthorizationConfig
|
||||
BackChannelLogoutSupported bool
|
||||
BackChannelLogoutSessionSupported bool
|
||||
}
|
||||
|
||||
// Endpoints defines endpoint routes.
|
||||
|
@ -411,6 +413,14 @@ func (o *Provider) DeviceAuthorization() DeviceAuthorizationConfig {
|
|||
return o.config.DeviceAuthorization
|
||||
}
|
||||
|
||||
func (o *Provider) BackChannelLogoutSupported() bool {
|
||||
return o.config.BackChannelLogoutSupported
|
||||
}
|
||||
|
||||
func (o *Provider) BackChannelLogoutSessionSupported() bool {
|
||||
return o.config.BackChannelLogoutSessionSupported
|
||||
}
|
||||
|
||||
func (o *Provider) Storage() Storage {
|
||||
return o.storage
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue