修复HTTP验证测试并按实际签发配置复核项目权限
This commit is contained in:
1 parent
16224fa1f5
commit
201a272562
10 files changed
+221
-2
No files matched your search
@@ -0,0 +1,25 @@
|
||||
package certificate
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.pcux.cn/xuans/Scert/backend/internal/domain"
|
||||
)
|
||||
|
||||
type issueAuthorizerContextKey struct{}
|
||||
|
||||
// IssueAuthorizer 检查签发实际使用的配置快照,而不是先前读取的验证方式。
|
||||
type IssueAuthorizer func(context.Context, domain.Domain) error
|
||||
|
||||
// WithIssueAuthorizer 为用户发起的工作流绑定实时授权;系统续期不使用用户会话。
|
||||
func WithIssueAuthorizer(ctx context.Context, authorize IssueAuthorizer) context.Context {
|
||||
return context.WithValue(ctx, issueAuthorizerContextKey{}, authorize)
|
||||
}
|
||||
|
||||
func authorizeIssueSnapshot(ctx context.Context, item domain.Domain) error {
|
||||
authorize, _ := ctx.Value(issueAuthorizerContextKey{}).(IssueAuthorizer)
|
||||
if authorize == nil {
|
||||
return nil
|
||||
}
|
||||
return authorize(ctx, item)
|
||||
}
|
||||
Reference in new issue
Block a user