Skip to content

Commit

Permalink
chore: remove unused interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
grantzvolsky committed Jul 30, 2022
1 parent e6e68c9 commit 2c80e62
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 10 deletions.
6 changes: 0 additions & 6 deletions client_with_custom_token_lifespans.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ func GetEffectiveLifespan(c Client, gt GrantType, tt TokenType, fallback time.Du
type ClientWithCustomTokenLifespans interface {
// GetEffectiveLifespan either maps GrantType x TokenType to the client's configured lifespan, or returns the fallback value.
GetEffectiveLifespan(gt GrantType, tt TokenType, fallback time.Duration) time.Duration

GetTokenLifespans() *ClientLifespanConfig

// SetTokenLifespans configures the per Client x GrantType x TokenType lifespan that
// can be specified to override fosite's TokenType default lifespan.
SetTokenLifespans(lifespans *ClientLifespanConfig)
}

// ClientLifespanConfig holds default lifespan configuration for the different
Expand Down
2 changes: 1 addition & 1 deletion handler/oauth2/flow_refresh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func TestRefreshFlow_HandleTokenEndpointRequest(t *testing.T) {
},
}

areq.Client.(fosite.ClientWithCustomTokenLifespans).SetTokenLifespans(&internal.TestLifespans)
areq.Client.(*fosite.DefaultClientWithCustomTokenLifespans).SetTokenLifespans(&internal.TestLifespans)

token, sig, err := strategy.GenerateRefreshToken(nil, nil)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion handler/openid/flow_hybrid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ func TestHybrid_HandleAuthorizeEndpointRequest(t *testing.T) {
Headers: &jwt.Headers{},
Subject: "peter",
}
areq.GetClient().(fosite.ClientWithCustomTokenLifespans).SetTokenLifespans(&internal.TestLifespans)
areq.GetClient().(*fosite.DefaultClientWithCustomTokenLifespans).SetTokenLifespans(&internal.TestLifespans)
return makeOpenIDConnectHybridHandler(fosite.MinParameterEntropy)
},
check: func() {
Expand Down
2 changes: 1 addition & 1 deletion handler/openid/flow_implicit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func TestImplicit_HandleAuthorizeEndpointRequest(t *testing.T) {
Scopes: []string{"openid", "fosite"},
},
}
areq.Client.(fosite.ClientWithCustomTokenLifespans).SetTokenLifespans(&internal.TestLifespans)
areq.Client.(*fosite.DefaultClientWithCustomTokenLifespans).SetTokenLifespans(&internal.TestLifespans)
return makeOpenIDConnectImplicitHandler(fosite.MinParameterEntropy)
},
check: func() {
Expand Down
2 changes: 1 addition & 1 deletion storage/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func (s *MemoryStore) GetClient(_ context.Context, id string) (fosite.Client, er

func (s *MemoryStore) SetTokenLifespans(clientID string, lifespans *fosite.ClientLifespanConfig) error {
if client, ok := s.Clients[clientID]; ok {
if clc, ok := client.(fosite.ClientWithCustomTokenLifespans); ok {
if clc, ok := client.(*fosite.DefaultClientWithCustomTokenLifespans); ok {
clc.SetTokenLifespans(lifespans)
return nil
}
Expand Down

0 comments on commit 2c80e62

Please sign in to comment.