Skip to content

Commit fec65c5

Browse files
committed
switch enabled/disabled
1 parent 1eb9062 commit fec65c5

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

service/internal/auth/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import "fmt"
44

55
// AuthConfig pulls AuthN and AuthZ together
66
type Config struct {
7-
DeprecatedEnabled bool `yaml:"deprecatedEnabled" default:"true"`
8-
AuthNConfig `mapstructure:",squash"`
7+
DeprecatedDisabled bool `yaml:"deprecatedDisabled" default:"false"`
8+
AuthNConfig `mapstructure:",squash"`
99
}
1010

1111
// AuthNConfig is the configuration need for the platform to validate tokens

service/internal/server/server.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ func NewOpenTDFServer(config Config, d *db.Client) (*OpenTDFServer, error) {
8989

9090
// Add authN interceptor
9191
// TODO Remove this conditional once we move to the hardening phase (https://github.com/opentdf/platform/issues/381)
92-
if config.Auth.DeprecatedEnabled {
92+
if config.Auth.DeprecatedDisabled {
93+
slog.Error("disabling authentication. this is deprecated and will be removed. if you are using an IdP without DPoP you can use `allowNoDPoP`")
94+
} else {
9395
slog.Info("authentication enabled")
9496
authN, err = auth.NewAuthenticator(
9597
context.Background(),
@@ -99,8 +101,6 @@ func NewOpenTDFServer(config Config, d *db.Client) (*OpenTDFServer, error) {
99101
if err != nil {
100102
return nil, fmt.Errorf("failed to create authentication interceptor: %w", err)
101103
}
102-
} else {
103-
slog.Error("disabling authentication. this is deprecated and will be removed. if you are using an IdP without DPoP you can use `allowNoDPoP`")
104104
}
105105

106106
// Try an register oidc issuer to wellknown service but don't return an error if it fails
@@ -162,10 +162,10 @@ func newHttpServer(c Config, h http.Handler, a *auth.Authentication, g *grpc.Ser
162162

163163
// Add authN interceptor
164164
// TODO check if this is needed or if it is handled by gRPC
165-
if c.Auth.DeprecatedEnabled {
166-
h = a.MuxHandler(h)
167-
} else {
165+
if c.Auth.DeprecatedDisabled {
168166
slog.Error("disabling authentication. this is deprecated and will be removed. if you are using an IdP without DPoP you can use `allowNoDPoP`")
167+
} else {
168+
h = a.MuxHandler(h)
169169
}
170170

171171
// Add CORS // TODO We need to make cors configurable (https://github.com/opentdf/platform/issues/305)
@@ -222,7 +222,11 @@ func newGrpcServer(c Config, a *auth.Authentication) (*grpc.Server, error) {
222222
slog.Warn("failed to create proto validator", slog.String("error", err.Error()))
223223
}
224224

225-
i = append(i, a.UnaryServerInterceptor)
225+
if c.Auth.DeprecatedDisabled {
226+
slog.Error("disabling authentication. this is deprecated and will be removed. if you are using an IdP without DPoP you can use `allowNoDpop`")
227+
} else {
228+
i = append(i, a.UnaryServerInterceptor)
229+
}
226230

227231
// Add tls creds if tls is not nil
228232
if c.TLS.Enabled {

0 commit comments

Comments
 (0)