IJwtTokenServiceIssueToken Method |
Creates and serializes the JWT token.
Namespace: CMS.Base.InternalAssembly: CMS.Base (in CMS.Base.dll) Version: 13.0.131
Syntax string IssueToken(
string userName,
DateTime validTo,
IEnumerable<Claim> customClaims = null,
Nullable<DateTime> validFrom = null
)
Parameters
- userName
- Type: SystemString
User name (the principal that is the subject of the JWT). - validTo
- Type: SystemDateTime
Expiration date of the JWT token. - customClaims (Optional)
- Type: System.Collections.GenericIEnumerableClaim
Custom JWT token claims - validFrom (Optional)
- Type: SystemNullableDateTime
The valid-from date specifies the time the JWT token becomes effective.
Return Value
Type:
StringSerialized the JWT token.
Exceptions Exception | Condition |
---|
ArgumentNullException | Throws when userName is null. |
ArgumentException | Throw when validTo is in the past. |
See Also