kubernetes/pkg/serviceaccount
Taahir Ahmed b4e99584ce serviceaccounts: Add JWT KeyIDs to tokens
This commit fills out the JWT "kid" (KeyID) field on most
serviceaccount tokens we create.  The KeyID value we use is derived
from the public key of keypair that backs the cluster's OIDC issuer.

OIDC verifiers use the KeyID to smoothly cope with key rotations:

  * During a rotation, the verifier will have multiple keys cached
    from the issuer, any of which could have signed the token being
    verified.  KeyIDs let the verifier pick the appropriate key
    without having to try each one.

  * Seeing a new KeyID is a trigger for the verifier to invalidate its
    cached keys and fetch the new set of valid keys from the identity
    provider.

The value we use for the KeyID is derived from the identity provider's
public key by serializing it in DER format, taking the SHA256 hash,
and then urlsafe base64-encoding it.  This gives a value that is
strongly bound to the key, but can't be reversed to obtain the public
key, which keeps people from being tempted to derive the key from the
key ID and using that for verification.

Tokens based on jose OpaqueSigners are omitted for now --- I don't see
any way to actually run the API server that results in an OpaqueSigner
being used.
2019-08-28 14:18:23 -07:00
..
BUILD serviceaccounts: Add JWT KeyIDs to tokens 2019-08-28 14:18:23 -07:00
claims_test.go rebase authenticators onto new interface. 2018-10-22 10:16:59 -07:00
claims.go retrofit svcacct token authenticator to support audience validation 2018-11-13 20:38:41 -08:00
jwt_test.go serviceaccounts: Add JWT KeyIDs to tokens 2019-08-28 14:18:23 -07:00
jwt.go serviceaccounts: Add JWT KeyIDs to tokens 2019-08-28 14:18:23 -07:00
legacy.go Move from glog to klog 2018-11-10 07:50:31 -05:00
OWNERS Updated OWNERS files to include link to docs 2019-02-04 22:33:12 +01:00
util_test.go add a test case which check secret's type 2018-09-26 09:21:36 +08:00
util.go svcacct: pass pod information in user.Info.Extra() when available 2018-08-31 11:54:50 -07:00