Implementing authentication on a web page through a WinForms application

and here is the situation ...

The client installed my winopers super dooper application. The username and password are authenticated when the application starts with my MSSQL server.

I would like to redirect the user to my web page and make him “registered” when he clicks the “Renew subscription” button in my application (without having to force him to enter the username and password on the web page).

Any ideas or cons are welcome.

+3
source share
4 answers

I would suggest a small change in your architecture.

WinForms -, . , + .

-, , / -, , , , WinForms - .

, WinForms - (http://www.example.com/?token=08A78B2101EB4a09B2ACE8AF6D6BA993). , , :

select user_id from users where md5(concat(username, password)) = 'TOKEN_HERE'

- (, GUID) -, , , .

+1

, HTTPS, .

# / :

        string authHeader = application.Request.Headers["Authorization"];
        if (authHeader.ToUpper().Contains("BASIC"))
        {
            //get the user name/password
            string decodedResponseString = Encoding.Default.GetString(Convert.FromBase64String(authHeader.Substring(6)));
            int dividerIndex = decodedResponseString.IndexOf(':');
            userName = decodedResponseString.Substring(0, dividerIndex);
            password = decodedResponseString.Substring(dividerIndex + 1);

, (, addheader ('authorization', 'basic (username: password encrypted in base 64)').

, , , ( cookie)

: ; , ,

+1

? , (-, ..).

, , . , , .

0

: " " . (GUID - ). - www.yourserver.com?token=, - , . . , , .

. , . .

0

Source: https://habr.com/ru/post/1713502/


All Articles