Hi community
i'm working on the validation user method , i found this following code in the \HSIE\%SYS\Classes\%OAuth2\Server\Validate.cls
ClassMethod ValidateUser(username As %String, password As %String, scope As %ArrayOfDataTypes, properties As %OAuth2.Server.Properties, Output sc As %Status) As %Boolean
{
// Check if user is defined.
// We use local Cache user list as the shipped default.
If '##class(Security.Users).Exists(username,.user,.sc) || $$$ISERR(sc) {
If $$$ISERR(sc),$$$GETERRORCODE(sc)=$$$ERRORCODE($$$UserDoesNotExist) {
Set sc=$$$OK
}
Quit 0
}
// Check the password
If password'="",'##class(Security.Users).CheckPassword(user,password) {
Quit 0
}
// Get the properties associated with this user.
Set sc=##class(Security.Users).GetProperties(user,.prop)
If $$$ISERR(sc) Quit 0
// Use the Cache roles for the user to setup a custom property.
Set sc=##class(Security.Roles).RecurseRoleSet(prop("Roles"),.roles)
If $$$ISERR(sc) Quit 0
set roles=prop("Roles")
Do properties.CustomProperties.SetAt(roles,"roles")
// Setup claims for profile and email OpenID Connect scopes.
Do properties.SetClaimValue("sub",username)
Do properties.SetClaimValue("preferred_username",username)
If $get(prop("EmailAddress"))'="" {
Do properties.SetClaimValue("email",prop("EmailAddress"))
Do properties.SetClaimValue("email_verified",0,"boolean")
}
If $get(prop("FullName"))'="" {
Do properties.SetClaimValue("name",prop("FullName"))
}
If $get(prop("PhoneNumber"))'="" {
Do properties.SetClaimValue("phone_number",prop("PhoneNumber"))
Do properties.SetClaimValue("phone_number_verified",0,"boolean")
}
// Setup claim for when user last updated.
If $get(prop("LastModifiedDateTime"))'="" {
Set time=##class(%OAuth2.Utils).TimeInSeconds(prop("LastModifiedDateTime"),0)
Do properties.SetClaimValue("updated_at",time,"number")
}
Quit 1
}