Commit 927b6354 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

Fix crash during certain irma_configuration updates

parent 5fae336e
......@@ -401,6 +401,46 @@ func TestIssueOptionalAttributeUpdateSchemeManager(t *testing.T) {
test.ClearTestStorage(t)
}
func TestIssueNewCredTypeUpdateSchemeManager(t *testing.T) {
client := parseStorage(t)
schemeid := irma.NewSchemeManagerIdentifier("irma-demo")
credid := irma.NewCredentialTypeIdentifier("irma-demo.RU.studentCard")
delete(client.Configuration.CredentialTypes, credid)
require.NotContains(t, client.Configuration.CredentialTypes, credid)
client.Configuration.SchemeManagers[schemeid].URL = "http://localhost:48681/irma_configuration_updated/irma-demo"
request := getIssuanceRequest(true)
client.Configuration.Download(request)
require.Contains(t, client.Configuration.CredentialTypes, credid)
test.ClearTestStorage(t)
}
func TestDisclosureNewCredTypeUpdateSchemeManager(t *testing.T) {
client := parseStorage(t)
schemeid := irma.NewSchemeManagerIdentifier("irma-demo")
credid := irma.NewCredentialTypeIdentifier("irma-demo.RU.studentCard")
attrid := irma.NewAttributeTypeIdentifier("irma-demo.RU.studentCard.level")
delete(client.Configuration.CredentialTypes, credid)
require.NotContains(t, client.Configuration.CredentialTypes, credid)
client.Configuration.SchemeManagers[schemeid].URL = "http://localhost:48681/irma_configuration_updated/irma-demo"
request := &irma.DisclosureRequest{
Content: irma.AttributeDisjunctionList([]*irma.AttributeDisjunction{{
Label: "foo",
Attributes: []irma.AttributeTypeIdentifier{attrid},
}}),
}
client.Configuration.Download(request)
require.Contains(t, client.Configuration.CredentialTypes, credid)
test.ClearTestStorage(t)
}
// Test installing a new scheme manager from a qr, and do a(n issuance) session
// within this manager to test the autmatic downloading of credential definitions,
// issuers, and public keys.
......
......@@ -714,6 +714,7 @@ func (conf *Configuration) checkCredentialTypes(session IrmaSession, managers ma
credid := attrid.CredentialTypeIdentifier()
if typ, contains = conf.CredentialTypes[credid]; !contains {
managers[credid.Root()] = struct{}{}
continue
}
if !typ.ContainsAttribute(attrid) {
managers[credid.Root()] = struct{}{}
......
Supports Markdown
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