storj/satellite/oidc/service.go
Egon Elbre 0d2d59f884 all: fix linting issues
Change-Id: Idfc93948e59a181321d79b365e638d63e256a16f
2022-03-21 15:26:42 +00:00

34 lines
800 B
Go

// Copyright (C) 2022 Storj Labs, Inc.
// See LICENSE for copying information.
package oidc
// NewService constructs a service for handling various OAuth and OIDC operations.
func NewService(db DB) *Service {
return &Service{
store: db,
}
}
// Service provides common implementations for managing clients and tokens.
//
// architecture: Service
type Service struct {
store DB
}
// ClientStore returns a store used to lookup oauth clients from the consent flow.
func (s *Service) ClientStore() *ClientStore {
return &ClientStore{
clients: s.store.OAuthClients(),
}
}
// TokenStore returns a store used to manage access tokens during the consent flow.
func (s *Service) TokenStore() *TokenStore {
return &TokenStore{
codes: s.store.OAuthCodes(),
tokens: s.store.OAuthTokens(),
}
}