pub struct ToolJwt {Show 15 fields
pub client_id: String,
pub iss: String,
pub sub: String,
pub exp: i64,
pub iat: i64,
pub names_and_roles_endpoint_url: Option<String>,
pub platform_iss: String,
pub deep_link_claim_data: Option<String>,
pub email: Option<String>,
pub name: Option<String>,
pub deployment_id: String,
pub message_type: String,
pub roles: Vec<String>,
pub context: Option<LtiContextClaim>,
pub resource_link: Option<LtiResourceLinkClaim>,
}Expand description
JWT structure for Tool-issued tokens
This structure represents the JWT token that the LTI Tool issues to clients after a successful LTI launch. It contains essential claims from the original LTI ID Token plus metadata needed by the client application.
The structure uses full LTI claim URIs with serde rename attributes to ensure proper serialization/deserialization while maintaining clean field names in code.
§Example
use atomic_lti_tool::tool_jwt::{ToolJwt, LtiContextClaim, LtiResourceLinkClaim};
use chrono::{Duration, Utc};
let tool_jwt = ToolJwt {
client_id: "my-client-123".to_string(),
iss: "https://mytool.example.com".to_string(),
sub: "user-456".to_string(),
exp: (Utc::now() + Duration::minutes(60)).timestamp(),
iat: Utc::now().timestamp(),
names_and_roles_endpoint_url: Some("https://lms.example.com/nrps".to_string()),
platform_iss: "https://lms.example.com".to_string(),
deep_link_claim_data: None,
email: Some("user@example.com".to_string()),
name: Some("Test User".to_string()),
deployment_id: "deployment-789".to_string(),
message_type: "LtiResourceLinkRequest".to_string(),
roles: vec!["http://purl.imsglobal.org/vocab/lis/v2/membership#Learner".to_string()],
context: Some(LtiContextClaim {
id: "course-123".to_string(),
}),
resource_link: Some(LtiResourceLinkClaim {
id: "link-456".to_string(),
}),
};Fields§
§client_id: StringClient ID from the LTI platform (identifies the tool registration)
iss: StringIssuer - the URL of this tool
sub: StringSubject - the user ID from the LMS
exp: i64Expiration time (Unix timestamp)
iat: i64Issued at time (Unix timestamp)
names_and_roles_endpoint_url: Option<String>Optional endpoint URL for Names and Roles Provisioning Service
platform_iss: StringIssuer of the original platform (LMS URL)
deep_link_claim_data: Option<String>Optional data from deep linking claim
email: Option<String>User’s email address from the LTI platform
name: Option<String>User’s full name from the LTI platform
deployment_id: StringLTI Deployment ID - identifies a specific deployment of the tool
See: https://www.imsglobal.org/spec/lti/v1p3#deployment-id-claim
message_type: StringLTI Message Type (e.g., “LtiResourceLinkRequest”, “LtiDeepLinkingRequest”)
See: https://www.imsglobal.org/spec/lti/v1p3#message-type-claim
roles: Vec<String>User’s roles within the context (e.g., Learner, Instructor)
See: https://www.imsglobal.org/spec/lti/v1p3#roles-claim
context: Option<LtiContextClaim>Context information (e.g., course) - optional as not all launches have context
See: https://www.imsglobal.org/spec/lti/v1p3#context-claim
resource_link: Option<LtiResourceLinkClaim>Resource link information - identifies the specific placement of the tool
See: https://www.imsglobal.org/spec/lti/v1p3#resource-link-claim