HashPassword
No edit summary
(Updated Edited template to July 12, 2025.)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
In order to Hash and Validate Turnkey passwords, you must add two ExternalLateBound methods to SysUser.
<message>Write the content here to display this box</message>
In order to Hash and Validate Turnkey passwords, add two ExternalLateBound methods to SysUser.
  HashPassword(pwd:String):String
  HashPassword(pwd:String):String
  VerifyHashedPassword(hash:String; pwd:String):Integer
  VerifyHashedPassword(hash:String; pwd:String):Integer
SysUser must also have an attribute Email:string(?) in .net core since the underlying pwd salt uses the email.
'''Note for''' '''.Net Core''': SysUser must also have an attribute Email:string(?) in .net core since the underlying pwd salt uses the email. If that is not present, you will see "SysUser: No member named Email" in the Turnkey log.


These methods must have Tagged Value Eco.ExternalLateBound on them. Set any value - we only check its existence.
'''.Net Core''' These methods must have Tagged Value Eco.ExternalLateBound on them. Set any value - we only check its existence.


'''NOTE''': When you run with CodeDress, you should '''leave Body empty''' for ExternalLateBound methods - if it is not empty, this will be executed instead of ExternalOverride. Leaving it empty will force the Codegen to create a stub - but this will be ignored for ExternalLateBound. Mind that you may need to add return statements, etc to the stub to make it compile. Like this:
'''NOTE''': When you run with CodeDress, you should '''leave Body empty''' for ExternalLateBound methods. If it is not empty, this will be executed instead of ExternalOverride. Leaving it empty will force the Codegen to create a stub - but this will be ignored for ExternalLateBound. Mind that you may need to add return statements, etc to the stub to make it compile. Like this:
  public string HashPassword(string pwd)
  public string HashPassword(string pwd)
  {
  {
Line 17: Line 18:
[[File:2018-08-02 13h38 18.png|none|thumb|281x281px|x]]
[[File:2018-08-02 13h38 18.png|none|thumb|281x281px|x]]
[[Category:Security]]
[[Category:Security]]
{{Edited|July|12|2025}}

Latest revision as of 05:50, 20 January 2025

This page was created by Hans.karlsen@mdriven.net on 2018-08-02. Last edited by Edgar on 2025-01-20.

In order to Hash and Validate Turnkey passwords, add two ExternalLateBound methods to SysUser.

HashPassword(pwd:String):String
VerifyHashedPassword(hash:String; pwd:String):Integer

Note for .Net Core: SysUser must also have an attribute Email:string(?) in .net core since the underlying pwd salt uses the email. If that is not present, you will see "SysUser: No member named Email" in the Turnkey log.

.Net Core These methods must have Tagged Value Eco.ExternalLateBound on them. Set any value - we only check its existence.

NOTE: When you run with CodeDress, you should leave Body empty for ExternalLateBound methods. If it is not empty, this will be executed instead of ExternalOverride. Leaving it empty will force the Codegen to create a stub - but this will be ignored for ExternalLateBound. Mind that you may need to add return statements, etc to the stub to make it compile. Like this:

public string HashPassword(string pwd)
{
  return "";
}

The VerifyHashedPassword returns an integer that is defined as:

Failed = 0,
Success = 1,
SuccessRehashNeeded = 2
x