Use configuration for report url duration
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -31,6 +31,7 @@ type (
|
||||
CookieDomain string `json:"cookie-domain"`
|
||||
CookieDuration int `json:"cookie-duration"`
|
||||
TokenDuration int `json:"token-duration"`
|
||||
ReportURLDuration int `json:"report-url-duration"`
|
||||
TokenSecret string `json:"token-secret"`
|
||||
Scope string `json:"scope"`
|
||||
TokenType string `json:"token-type"`
|
||||
|
||||
@@ -106,6 +106,7 @@ func New() *Implm {
|
||||
CookieDomain: "localhost",
|
||||
CookieDuration: 24,
|
||||
TokenDuration: 168,
|
||||
ReportURLDuration: 15,
|
||||
TokenSecret: "this-is-a-secure-secret-for-trust-token-signing-at-least-32-bytes",
|
||||
Scope: "trust_center_readonly",
|
||||
TokenType: "trust_center_access",
|
||||
@@ -288,6 +289,7 @@ func (impl *Implm) Run(
|
||||
CookieDomain: impl.cfg.TrustAuth.CookieDomain,
|
||||
CookieDuration: time.Duration(impl.cfg.TrustAuth.CookieDuration) * time.Hour,
|
||||
TokenDuration: time.Duration(impl.cfg.TrustAuth.TokenDuration) * time.Hour,
|
||||
ReportURLDuration: time.Duration(impl.cfg.TrustAuth.ReportURLDuration) * time.Minute,
|
||||
TokenSecret: impl.cfg.TrustAuth.TokenSecret,
|
||||
Scope: impl.cfg.TrustAuth.Scope,
|
||||
TokenType: impl.cfg.TrustAuth.TokenType,
|
||||
|
||||
@@ -46,6 +46,7 @@ type (
|
||||
CookieDomain string
|
||||
CookieDuration time.Duration
|
||||
TokenDuration time.Duration
|
||||
ReportURLDuration time.Duration
|
||||
TokenSecret string
|
||||
Scope string
|
||||
TokenType string
|
||||
@@ -174,6 +175,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
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,
|
||||
|
||||
@@ -46,6 +46,7 @@ type (
|
||||
CookieDomain string
|
||||
CookieDuration time.Duration
|
||||
TokenDuration time.Duration
|
||||
ReportURLDuration time.Duration
|
||||
TokenSecret string
|
||||
Scope string
|
||||
TokenType string
|
||||
|
||||
@@ -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