Communication/Authentication . net for PHP

Asked

Viewed 65 times

1

I need to implement an authentication system on a page.

The scenario is as follows, I have a page that can only be accessed by authenticated users coming from a site (in ASP). This on the client side.

I thought of a scenario where on my side there is a mechanism (in PHP) that validates if the client was/came authenticated or not... I thought about sending a client-side encrypted key and that PHP validating this key would allow access to the contents, however I do not know how to do it in . net, since what the client has is a CMS.

Someone has an idea how to help me?

1 answer

1

In the . Net application, create a button, for example, where the user will click to access the PHP application on the other server.

By clicking this button, a token is generated (unique encrypted key).

The token will serve as authentication. The logic is to generate Toke from the app . Net and save it to a database.

This token must be related to the user identification in the PHP application. Therefore you need to solve a way to create this link.

A simple mode is a screen on . Net with a form where the user enters the login and password data for accessing the PHP application. These data would be saved in the app’s database. Net so you could link to the tokens.

Once the structure is done, we continue. When you click the button, the token is generated and the user is directed to the PHP app.

The PHP app receives the token and checks if it is valid by checking the database from which it was previously saved. For this query, an API (webservice) is recommended. Avoid making a query directly to the database. Consult for an API.

After verifying that the token is valid, if it is valid, it will search for the relationship with the user and make the authentication in the PHP app.

Important: The token must be deleted or invalidated whenever used. The token can only be used once.

inserir a descrição da imagem aqui

Note that this is all independent of the languages you use on both sides. The app. net could be a Java app and the PHP app could be a Ror app. The logic of the authentication token is the same.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.