-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[INJICERT-299] add Sunbird's credential contexts (#97)
Signed-off-by: Harsh Vardhan <[email protected]>
- Loading branch information
Showing
3 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
##Here we are injecting DateTool instance from java velocity library to set the expiry date | ||
#set( $defaultLocale = $date.getLocale() ) | ||
#set( $calenderNow = $date.getCalendar() ) | ||
#set( $ISO8601DateTimeWithMillisUTC = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" ) | ||
## Adding no. of Days we want to set as expiry,here '5' represent Day and '30' represent no. of days | ||
#set( $expiry =$calenderNow.add(5,30)) | ||
#set( $formattedPolicyIssuedOn = $date.toDate($ISO8601DateTimeWithMillisUTC, ${policyIssuedOn})) | ||
#set( $formattedPolicyExpiresOn = $date.toDate($ISO8601DateTimeWithMillisUTC, ${policyExpiresOn})) | ||
{ | ||
"@context": [ | ||
"https://www.w3.org/2018/credentials/v1", | ||
"https://holashchand.github.io/test_project/insurance-context.json" | ||
], | ||
"type": [ | ||
"VerifiableCredential", | ||
"InsuranceCredential" | ||
], | ||
"issuer": "${issuerId}", | ||
"expirationDate": "${date.format($ISO8601DateTimeWithMillisUTC, $calenderNow, $defaultLocale)}", | ||
"credentialSubject": { | ||
"dob": "${dob}", | ||
"gender": "${gender}", | ||
"mobile": "${mobile}", | ||
"benefits": #if($benefits)$benefits#else#set($benefits = '"[]"') $benefits#end, | ||
"fullName": "${fullName}", | ||
"email": "${email}", | ||
"policyIssuedOn": "${date.format('yyyy-MM-dd', $formattedPolicyIssuedOn)}", | ||
"policyExpiresOn": "${date.format('yyyy-MM-dd', $formattedPolicyExpiresOn)}", | ||
"policyName": "${policyName}", | ||
"policyNumber": "${policyNumber}" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
##Here we are injecting DateTool instance from java velocity library to set the expiry date | ||
#set( $defaultLocale = $date.getLocale() ) | ||
#set( $calenderNow = $date.getCalendar() ) | ||
#set( $ISO8601DateTimeWithMillisUTC = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" ) | ||
## Adding no. of Days we want to set as expiry, here '5' represent Day and '30' represent no. of days | ||
#set( $expiry =$calenderNow.add(5, 30)) | ||
#set( $formattedPolicyIssuedOn = $date.toDate($ISO8601DateTimeWithMillisUTC, ${policyIssuedOn})) | ||
#set( $formattedPolicyExpiresOn = $date.toDate($ISO8601DateTimeWithMillisUTC, ${policyExpiresOn})) | ||
{ | ||
"@context": [ | ||
"https://www.w3.org/2018/credentials/v1", | ||
"https://holashchand.github.io/test_project/insurance-context.json", | ||
{ | ||
"LifeInsuranceCredential": { | ||
"@id":"InsuranceCredential" | ||
} | ||
} | ||
], | ||
"type": [ | ||
"VerifiableCredential", | ||
"LifeInsuranceCredential" | ||
], | ||
"issuer": "${issuerId}", | ||
"expirationDate": "${date.format($ISO8601DateTimeWithMillisUTC, $calenderNow, $defaultLocale)}", | ||
"credentialSubject": { | ||
"dob": "${dob}", | ||
"gender": "${gender}", | ||
"mobile": "${mobile}", | ||
"benefits": #if($benefits)$benefits#else#set($benefits = '"[]"') $benefits#end, | ||
"fullName": "${fullName}", | ||
"email": "${email}", | ||
"policyIssuedOn": "${date.format('yyyy-MM-dd', $formattedPolicyIssuedOn)}", | ||
"policyExpiresOn": "${date.format('yyyy-MM-dd', $formattedPolicyExpiresOn)}", | ||
"policyName": "${policyName}", | ||
"policyNumber": "${policyNumber}" | ||
} | ||
} |