SQL-based authentication: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
|||
Line 197: | Line 197: | ||
From the command line, <tt>program add user password</tt> to add users, and <tt>program auth user password</tt> to see if the user with that password is authorized or not. |
From the command line, <tt>program add user password</tt> to add users, and <tt>program auth user password</tt> to see if the user with that password is authorized or not. |
||
=={{header|C#}}== |
=={{header|C sharp|C#}}== |
||
Class for hashing and random salt generation. |
Class for hashing and random salt generation. |
||
<lang csharp>using System.Security.Cryptography; |
<lang csharp>using System.Security.Cryptography; |
||
Line 920: | Line 920: | ||
undef, $user, $pass); |
undef, $user, $pass); |
||
$userid |
$userid |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
}</lang> |
}</lang> |
||
Line 1,265: | Line 1,232: | ||
(check-exn exn:fail? (λ () (authenticate-user test-DB #"tim" #"password"))) |
(check-exn exn:fail? (λ () (authenticate-user test-DB #"tim" #"password"))) |
||
(check-true (authenticate-user test-DB #"tim" #"shh! it's a secret!")))</lang> |
(check-true (authenticate-user test-DB #"tim" #"shh! it's a secret!")))</lang> |
||
⚫ | |||
(formerly Perl 6) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|Raven}}== |
=={{header|Raven}}== |