|
@@ -79,6 +79,15 @@ func (a *Authority) Authorize(ott string) ([]api.Claim, error) {
|
|
|
http.StatusUnauthorized, errContext}
|
|
http.StatusUnauthorized, errContext}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // Do not accept tokens issued before the start of the ca.
|
|
|
|
|
+ // This check is meant as a stopgap solution to the current lack of a persistence layer.
|
|
|
|
|
+ if a.config.AuthorityConfig != nil && !a.config.AuthorityConfig.DisableIssuedAtCheck {
|
|
|
|
|
+ if claims.IssuedAt > 0 && claims.IssuedAt.Time().Before(a.startTime) {
|
|
|
|
|
+ return nil, &apiError{errors.New("token issued before the bootstrap of certificate authority"),
|
|
|
|
|
+ http.StatusUnauthorized, errContext}
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if !containsAtLeastOneAudience(claims.Audience, a.audiences) {
|
|
if !containsAtLeastOneAudience(claims.Audience, a.audiences) {
|
|
|
return nil, &apiError{errors.New("invalid audience"), http.StatusUnauthorized,
|
|
return nil, &apiError{errors.New("invalid audience"), http.StatusUnauthorized,
|
|
|
errContext}
|
|
errContext}
|