From 8343e020ad61b27bcdfb343432eaf71002f4daa4 Mon Sep 17 00:00:00 2001 From: Romain Caire Date: Fri, 9 Sep 2022 01:40:02 +0200 Subject: [PATCH] Fix styling --- compose/compose.go | 30 ++++++++++++++--------------- internal/access_request.go | 1 + internal/access_response.go | 1 + internal/access_token_storage.go | 1 + internal/access_token_strategy.go | 1 + internal/authorize_code_storage.go | 1 + internal/authorize_code_strategy.go | 1 + internal/authorize_handler.go | 1 + internal/authorize_request.go | 1 + internal/client.go | 28 +++++++++++++++++++++++++++ internal/id_token_strategy.go | 1 + internal/introspector.go | 1 + internal/oauth2_client_storage.go | 1 + internal/oauth2_owner_storage.go | 1 + internal/oauth2_revoke_storage.go | 1 + internal/oauth2_storage.go | 1 + internal/oauth2_strategy.go | 1 + internal/openid_id_token_storage.go | 1 + internal/pkce_storage_strategy.go | 1 + internal/refresh_token_strategy.go | 1 + internal/request.go | 1 + internal/revoke_handler.go | 1 + internal/storage.go | 1 + internal/token_handler.go | 1 + 24 files changed, 65 insertions(+), 15 deletions(-) diff --git a/compose/compose.go b/compose/compose.go index 714b20752..7bf11f429 100644 --- a/compose/compose.go +++ b/compose/compose.go @@ -32,24 +32,24 @@ type Factory func(config fosite.Configurator, storage interface{}, strategy inte // Compose takes a config, a storage, a strategy and handlers to instantiate an OAuth2Provider: // -// import "github.com/ory/fosite/compose" +// import "github.com/ory/fosite/compose" // -// // var storage = new(MyFositeStorage) -// var config = Config { -// AccessTokenLifespan: time.Minute * 30, -// // check Config for further configuration options -// } +// // var storage = new(MyFositeStorage) +// var config = Config { +// AccessTokenLifespan: time.Minute * 30, +// // check Config for further configuration options +// } // -// var strategy = NewOAuth2HMACStrategy(config) +// var strategy = NewOAuth2HMACStrategy(config) // -// var oauth2Provider = Compose( -// config, -// storage, -// strategy, -// NewOAuth2AuthorizeExplicitHandler, -// OAuth2ClientCredentialsGrantFactory, -// // for a complete list refer to the docs of this package -// ) +// var oauth2Provider = Compose( +// config, +// storage, +// strategy, +// NewOAuth2AuthorizeExplicitHandler, +// OAuth2ClientCredentialsGrantFactory, +// // for a complete list refer to the docs of this package +// ) // // Compose makes use of interface{} types in order to be able to handle a all types of stores, strategies and handlers. func Compose(config *fosite.Config, storage interface{}, strategy interface{}, factories ...Factory) fosite.OAuth2Provider { diff --git a/internal/access_request.go b/internal/access_request.go index 149b920aa..7f408e080 100644 --- a/internal/access_request.go +++ b/internal/access_request.go @@ -10,6 +10,7 @@ import ( time "time" gomock "github.com/golang/mock/gomock" + fosite "github.com/ory/fosite" ) diff --git a/internal/access_response.go b/internal/access_response.go index cdd100769..9c383cb79 100644 --- a/internal/access_response.go +++ b/internal/access_response.go @@ -9,6 +9,7 @@ import ( time "time" gomock "github.com/golang/mock/gomock" + fosite "github.com/ory/fosite" ) diff --git a/internal/access_token_storage.go b/internal/access_token_storage.go index 7d4d80549..a30404098 100644 --- a/internal/access_token_storage.go +++ b/internal/access_token_storage.go @@ -9,6 +9,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" + fosite "github.com/ory/fosite" ) diff --git a/internal/access_token_strategy.go b/internal/access_token_strategy.go index 965404f64..a811e51cf 100644 --- a/internal/access_token_strategy.go +++ b/internal/access_token_strategy.go @@ -9,6 +9,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" + fosite "github.com/ory/fosite" ) diff --git a/internal/authorize_code_storage.go b/internal/authorize_code_storage.go index 75e62d4ac..ef3ab3b3c 100644 --- a/internal/authorize_code_storage.go +++ b/internal/authorize_code_storage.go @@ -9,6 +9,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" + fosite "github.com/ory/fosite" ) diff --git a/internal/authorize_code_strategy.go b/internal/authorize_code_strategy.go index 8baf3a2c4..cb826a23d 100644 --- a/internal/authorize_code_strategy.go +++ b/internal/authorize_code_strategy.go @@ -9,6 +9,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" + fosite "github.com/ory/fosite" ) diff --git a/internal/authorize_handler.go b/internal/authorize_handler.go index a660d7ebb..964fb7e4a 100644 --- a/internal/authorize_handler.go +++ b/internal/authorize_handler.go @@ -9,6 +9,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" + fosite "github.com/ory/fosite" ) diff --git a/internal/authorize_request.go b/internal/authorize_request.go index e3d2f959b..a643e04e8 100644 --- a/internal/authorize_request.go +++ b/internal/authorize_request.go @@ -10,6 +10,7 @@ import ( time "time" gomock "github.com/golang/mock/gomock" + fosite "github.com/ory/fosite" ) diff --git a/internal/client.go b/internal/client.go index b2299dc02..771660924 100644 --- a/internal/client.go +++ b/internal/client.go @@ -6,8 +6,10 @@ package internal import ( reflect "reflect" + time "time" gomock "github.com/golang/mock/gomock" + fosite "github.com/ory/fosite" ) @@ -132,6 +134,20 @@ func (mr *MockClientMockRecorder) GetScopes() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetScopes", reflect.TypeOf((*MockClient)(nil).GetScopes)) } +// GetTokenLifespan mocks base method. +func (m *MockClient) GetTokenLifespan(arg0 fosite.GrantType, arg1 fosite.TokenType, arg2 time.Duration) time.Duration { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTokenLifespan", arg0, arg1, arg2) + ret0, _ := ret[0].(time.Duration) + return ret0 +} + +// GetTokenLifespan indicates an expected call of GetTokenLifespan. +func (mr *MockClientMockRecorder) GetTokenLifespan(arg0, arg1, arg2 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTokenLifespan", reflect.TypeOf((*MockClient)(nil).GetTokenLifespan), arg0, arg1, arg2) +} + // IsPublic mocks base method. func (m *MockClient) IsPublic() bool { m.ctrl.T.Helper() @@ -145,3 +161,15 @@ func (mr *MockClientMockRecorder) IsPublic() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsPublic", reflect.TypeOf((*MockClient)(nil).IsPublic)) } + +// SetTokenLifespans mocks base method. +func (m *MockClient) SetTokenLifespans(arg0 map[fosite.TokenType]time.Duration) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetTokenLifespans", arg0) +} + +// SetTokenLifespans indicates an expected call of SetTokenLifespans. +func (mr *MockClientMockRecorder) SetTokenLifespans(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTokenLifespans", reflect.TypeOf((*MockClient)(nil).SetTokenLifespans), arg0) +} diff --git a/internal/id_token_strategy.go b/internal/id_token_strategy.go index 9ec9b8ce6..2e36d1488 100644 --- a/internal/id_token_strategy.go +++ b/internal/id_token_strategy.go @@ -10,6 +10,7 @@ import ( time "time" gomock "github.com/golang/mock/gomock" + fosite "github.com/ory/fosite" ) diff --git a/internal/introspector.go b/internal/introspector.go index 6744ec5f7..c47cf76e6 100644 --- a/internal/introspector.go +++ b/internal/introspector.go @@ -9,6 +9,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" + fosite "github.com/ory/fosite" ) diff --git a/internal/oauth2_client_storage.go b/internal/oauth2_client_storage.go index bb15e6c53..54770c89d 100644 --- a/internal/oauth2_client_storage.go +++ b/internal/oauth2_client_storage.go @@ -9,6 +9,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" + fosite "github.com/ory/fosite" ) diff --git a/internal/oauth2_owner_storage.go b/internal/oauth2_owner_storage.go index 37ace932f..ce53de4c8 100644 --- a/internal/oauth2_owner_storage.go +++ b/internal/oauth2_owner_storage.go @@ -9,6 +9,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" + fosite "github.com/ory/fosite" ) diff --git a/internal/oauth2_revoke_storage.go b/internal/oauth2_revoke_storage.go index c4b28282a..71f8e10a5 100644 --- a/internal/oauth2_revoke_storage.go +++ b/internal/oauth2_revoke_storage.go @@ -9,6 +9,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" + fosite "github.com/ory/fosite" ) diff --git a/internal/oauth2_storage.go b/internal/oauth2_storage.go index 0b63462df..97633402a 100644 --- a/internal/oauth2_storage.go +++ b/internal/oauth2_storage.go @@ -9,6 +9,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" + fosite "github.com/ory/fosite" ) diff --git a/internal/oauth2_strategy.go b/internal/oauth2_strategy.go index 4624cbcab..01a781934 100644 --- a/internal/oauth2_strategy.go +++ b/internal/oauth2_strategy.go @@ -9,6 +9,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" + fosite "github.com/ory/fosite" ) diff --git a/internal/openid_id_token_storage.go b/internal/openid_id_token_storage.go index 11f63c68d..9d33b855f 100644 --- a/internal/openid_id_token_storage.go +++ b/internal/openid_id_token_storage.go @@ -9,6 +9,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" + fosite "github.com/ory/fosite" ) diff --git a/internal/pkce_storage_strategy.go b/internal/pkce_storage_strategy.go index 0f25f14f4..1ab44f9ad 100644 --- a/internal/pkce_storage_strategy.go +++ b/internal/pkce_storage_strategy.go @@ -9,6 +9,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" + fosite "github.com/ory/fosite" ) diff --git a/internal/refresh_token_strategy.go b/internal/refresh_token_strategy.go index 99951c794..d0e0422e5 100644 --- a/internal/refresh_token_strategy.go +++ b/internal/refresh_token_strategy.go @@ -9,6 +9,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" + fosite "github.com/ory/fosite" ) diff --git a/internal/request.go b/internal/request.go index b833be8ba..ce642cb0d 100644 --- a/internal/request.go +++ b/internal/request.go @@ -10,6 +10,7 @@ import ( time "time" gomock "github.com/golang/mock/gomock" + fosite "github.com/ory/fosite" ) diff --git a/internal/revoke_handler.go b/internal/revoke_handler.go index ed542c112..75418fc70 100644 --- a/internal/revoke_handler.go +++ b/internal/revoke_handler.go @@ -9,6 +9,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" + fosite "github.com/ory/fosite" ) diff --git a/internal/storage.go b/internal/storage.go index e7b934cc4..a17da5f7e 100644 --- a/internal/storage.go +++ b/internal/storage.go @@ -10,6 +10,7 @@ import ( time "time" gomock "github.com/golang/mock/gomock" + fosite "github.com/ory/fosite" ) diff --git a/internal/token_handler.go b/internal/token_handler.go index 5ad46ac60..5e31065d3 100644 --- a/internal/token_handler.go +++ b/internal/token_handler.go @@ -9,6 +9,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" + fosite "github.com/ory/fosite" )