-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting Roles to single value results in incorrect claim value #100
Comments
@hisuwh What type of request are you creating? I don't see LtiResourceRequest in the codebase, only LtiResourceLinkRequest and LtiDeepLinkingRequest? I tried with this unit test, and this succeeds as well: [Fact]
public void Roles_SingleRole_ReturnsArray()
{
var request = new LtiResourceLinkRequest
{
DeploymentId = "12345",
TargetLinkUri = "https://www.example.edu",
ResourceLink = new ResourceLinkClaimValueType
{
Id = "12345"
},
UserId = "12345",
Roles = new[]{Role.ContextLearner}
};
Assert.True(request.TryGetValue("https://purl.imsglobal.org/spec/lti/claim/roles", out var rolesJson));
var roles = ((JsonElement)rolesJson).ToStringList();
Assert.Contains("http://purl.imsglobal.org/vocab/lis/v2/membership#Learner", roles);
} Maybe the NET6 merge fixed this? |
I don't think the way of reading the claim as you have above is representative. I see the same as you using |
I've been using https://saltire.lti.app/ to test this which doesn't like it, neither does the tool provider I am working with. |
The LTI 1.3 spec says this:
|
Can you explain, maybe with some code, what you mean by using |
As per your sample code here: |
If I set the Roles property to a single value:
Then the claim that gets sent is a string value (which is not correct and causes errors downstream):
However, if I set multiple values:
Then it correctly sends an array:
I was working around this previously by setting multiple Roles but that is not always appropriate for all Role types
The text was updated successfully, but these errors were encountered: