Use configuration for report url duration
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -42,13 +42,14 @@ type (
|
||||
}
|
||||
|
||||
TrustAuthConfig struct {
|
||||
CookieName string
|
||||
CookieDomain string
|
||||
CookieDuration time.Duration
|
||||
TokenDuration time.Duration
|
||||
TokenSecret string
|
||||
Scope string
|
||||
TokenType string
|
||||
CookieName string
|
||||
CookieDomain string
|
||||
CookieDuration time.Duration
|
||||
TokenDuration time.Duration
|
||||
ReportURLDuration time.Duration
|
||||
TokenSecret string
|
||||
Scope string
|
||||
TokenType string
|
||||
}
|
||||
|
||||
Config struct {
|
||||
@@ -170,13 +171,14 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
CookieSecret: s.cfg.Auth.CookieSecret,
|
||||
},
|
||||
trust_v1.TrustAuthConfig{
|
||||
CookieName: s.cfg.TrustAuth.CookieName,
|
||||
CookieDomain: s.cfg.TrustAuth.CookieDomain,
|
||||
CookieDuration: s.cfg.TrustAuth.CookieDuration,
|
||||
TokenDuration: s.cfg.TrustAuth.TokenDuration,
|
||||
TokenSecret: s.cfg.TrustAuth.TokenSecret,
|
||||
Scope: s.cfg.TrustAuth.Scope,
|
||||
TokenType: s.cfg.TrustAuth.TokenType,
|
||||
CookieName: s.cfg.TrustAuth.CookieName,
|
||||
CookieDomain: s.cfg.TrustAuth.CookieDomain,
|
||||
CookieDuration: s.cfg.TrustAuth.CookieDuration,
|
||||
TokenDuration: s.cfg.TrustAuth.TokenDuration,
|
||||
ReportURLDuration: s.cfg.TrustAuth.ReportURLDuration,
|
||||
TokenSecret: s.cfg.TrustAuth.TokenSecret,
|
||||
Scope: s.cfg.TrustAuth.Scope,
|
||||
TokenType: s.cfg.TrustAuth.TokenType,
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
@@ -42,13 +42,14 @@ import (
|
||||
|
||||
type (
|
||||
TrustAuthConfig struct {
|
||||
CookieName string
|
||||
CookieDomain string
|
||||
CookieDuration time.Duration
|
||||
TokenDuration time.Duration
|
||||
TokenSecret string
|
||||
Scope string
|
||||
TokenType string
|
||||
CookieName string
|
||||
CookieDomain string
|
||||
CookieDuration time.Duration
|
||||
TokenDuration time.Duration
|
||||
ReportURLDuration time.Duration
|
||||
TokenSecret string
|
||||
Scope string
|
||||
TokenType string
|
||||
}
|
||||
|
||||
Resolver struct {
|
||||
|
||||
@@ -73,7 +73,7 @@ func (r *auditResolver) ReportURL(ctx context.Context, obj *types.Audit) (*strin
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
url, err := trust.Audits.GenerateReportURL(ctx, obj.ID, 15*time.Minute)
|
||||
url, err := trust.Audits.GenerateReportURL(ctx, obj.ID, r.trustAuthCfg.ReportURLDuration)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot generate report URL: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user