Commit e05b43e3 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

Remove hardcoded magic string in keyshare username auto-issuance

parent e984652f
......@@ -19,8 +19,13 @@ var _ Handler = (*keyshareEnrollmentHandler)(nil)
// Session handlers in the order they are called
func (h *keyshareEnrollmentHandler) RequestIssuancePermission(request irma.IssuanceRequest, ServerName string, callback PermissionHandler) {
h.kss.Username = request.Credentials[0].Attributes["email"] // TODO magic string
// Fetch the username from the credential request and save it along with the scheme manager
smi := request.Credentials[0].CredentialTypeID.IssuerIdentifier().SchemeManagerIdentifier()
attr := irma.NewAttributeTypeIdentifier(h.client.Configuration.SchemeManagers[smi].KeyshareAttribute)
h.kss.Username = request.Credentials[0].Attributes[attr.Name()]
h.client.storage.StoreKeyshareServers(h.client.keyshareServers)
// Do the issuance
callback(true, nil)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment