fix redirect loop, remove user/session services, remove duplicate deleted_at fields (#1162)

* fix redirect loop, remove user/session services, remove duplicate deleted_at fields

* change loop

* reuse err variable

* wrap errors, use cookie timeout

* wrap error, duplicate if
This commit is contained in:
Caleb Doxsey 2020-07-30 09:41:57 -06:00 committed by GitHub
parent 714363fb07
commit 97f85481f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 288 additions and 918 deletions

14
cache/cache.go vendored
View file

@ -19,16 +19,12 @@ import (
"github.com/pomerium/pomerium/internal/urlutil"
"github.com/pomerium/pomerium/pkg/cryptutil"
"github.com/pomerium/pomerium/pkg/grpc/databroker"
"github.com/pomerium/pomerium/pkg/grpc/session"
"github.com/pomerium/pomerium/pkg/grpc/user"
)
// Cache represents the cache service. The cache service is a simple interface
// for storing keyed blobs (bytes) of unstructured data.
type Cache struct {
dataBrokerServer *DataBrokerServer
sessionServer *SessionServer
userServer *UserServer
manager *manager.Manager
localListener net.Listener
@ -73,16 +69,10 @@ func New(opts config.Options) (*Cache, error) {
dataBrokerServer := NewDataBrokerServer(localGRPCServer, opts)
dataBrokerClient := databroker.NewDataBrokerServiceClient(localGRPCConnection)
sessionServer := NewSessionServer(localGRPCServer, dataBrokerClient)
sessionClient := session.NewSessionServiceClient(localGRPCConnection)
userServer := NewUserServer(localGRPCServer, dataBrokerClient)
userClient := user.NewUserServiceClient(localGRPCConnection)
manager := manager.New(
authenticator,
directoryProvider,
sessionClient,
userClient,
dataBrokerClient,
manager.WithGroupRefreshInterval(opts.RefreshDirectoryInterval),
manager.WithGroupRefreshTimeout(opts.RefreshDirectoryTimeout),
@ -90,8 +80,6 @@ func New(opts config.Options) (*Cache, error) {
return &Cache{
dataBrokerServer: dataBrokerServer,
sessionServer: sessionServer,
userServer: userServer,
manager: manager,
localListener: localListener,
@ -104,8 +92,6 @@ func New(opts config.Options) (*Cache, error) {
// Register registers all the gRPC services with the given server.
func (c *Cache) Register(grpcServer *grpc.Server) {
databroker.RegisterDataBrokerServiceServer(grpcServer, c.dataBrokerServer)
session.RegisterSessionServiceServer(grpcServer, c.sessionServer)
user.RegisterUserServiceServer(grpcServer, c.userServer)
}
// Run runs the cache components.