Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions pkg/ctx/mfactx.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package ctx

import (
"context"

"google.golang.org/grpc/metadata"
)

// MFAOutgoingHeader is the gRPC metadata key used to propagate MFA status across
// service boundaries. The "autoprop-" prefix causes the metadata interceptor
// (internal/grpc/interceptors/metadata) to forward it automatically at every
Expand All @@ -9,3 +15,12 @@ const MFAOutgoingHeader = "autoprop-mfa-authenticated"

// The corresponding HTTP header set by the proxy is "X-Multi-Factor-Authentication".
const MFAHeader = "X-Multi-Factor-Authentication"

// AppendMFAToOutgoingContext adds the MFA status to the outgoing gRPC metadata.
func AppendMFAToOutgoingContext(ctx context.Context, hasMFA bool) context.Context {
mfaVal := "false"
if hasMFA {
mfaVal = "true"
}
return metadata.AppendToOutgoingContext(ctx, MFAOutgoingHeader, mfaVal)
}
Loading