Fix alias data being used for cert auth (serial number -> common name) (#4495)

Fixes #4475
This commit is contained in:
Jeff Mitchell 2018-05-04 10:08:23 -04:00 committed by GitHub
parent 9b9be9622a
commit b1d44a7dee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -90,6 +90,7 @@ func (b *backend) pathLogin(ctx context.Context, req *logical.Request, data *fra
Metadata: map[string]string{
"cert_name": matched.Entry.Name,
"common_name": clientCerts[0].Subject.CommonName,
"serial_number": clientCerts[0].SerialNumber.String(),
"subject_key_id": certutil.GetHexFormatted(clientCerts[0].SubjectKeyId, ":"),
"authority_key_id": certutil.GetHexFormatted(clientCerts[0].AuthorityKeyId, ":"),
},
@ -99,7 +100,7 @@ func (b *backend) pathLogin(ctx context.Context, req *logical.Request, data *fra
MaxTTL: matched.Entry.MaxTTL,
},
Alias: &logical.Alias{
Name: clientCerts[0].SerialNumber.String(),
Name: clientCerts[0].Subject.CommonName,
},
},
}