validate token length in tokenReview

This commit is contained in:
m1093782566
2017-08-04 12:13:11 +08:00
parent 3a0d8f8fea
commit 86eb95b0a8

View File

@@ -49,6 +49,10 @@ func (r *REST) Create(ctx genericapirequest.Context, obj runtime.Object, include
return nil, apierrors.NewBadRequest(fmt.Sprintf("namespace is not allowed on this type: %v", namespace))
}
if len(tokenReview.Spec.Token) == 0 {
return nil, apierrors.NewBadRequest(fmt.Sprintf("token is required for TokenReview in authentication"))
}
if r.tokenAuthenticator == nil {
return tokenReview, nil
}