Add compliange page base URL in context and use it to validate redirect URLs

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-03-03 16:39:13 +04:00
parent 823fc64c37
commit c4b06ddc7d
8 changed files with 58 additions and 11 deletions

View File

@@ -23,8 +23,9 @@ import (
type ctxKey struct{ name string }
var (
compliancePageKey = &ctxKey{name: "compliance_page"}
complianceMembershipKey = &ctxKey{name: "compliance_membership"}
compliancePageKey = &ctxKey{name: "compliance_page"}
complianceMembershipKey = &ctxKey{name: "compliance_membership"}
compliancePageBaseURLKey = &ctxKey{name: "compliance_page_base_url"}
)
func CompliancePageFromContext(ctx context.Context) *coredata.TrustCenter {
@@ -36,3 +37,8 @@ func ComplianceMembershipFromContext(ctx context.Context) *coredata.TrustCenterA
membership, _ := ctx.Value(complianceMembershipKey).(*coredata.TrustCenterAccess)
return membership
}
func CompliancePageBaseURLFromContext(ctx context.Context) *string {
page, _ := ctx.Value(compliancePageBaseURLKey).(*string)
return page
}