How to make a Laravel authentication by cryptographic key pair?

Hello.

Want to do the project on Laravel authentication based on asymmetric cryptography - no email and password - just the user to give the private key and database to store outdoor. Well, or via pass-phrase once implemented, does not matter.

I'm a Laravel beginner you don't know how to even go about it.

Can eat already ready decisions?

In General, I will appreciate any advice.

Thank you.
March 19th 20 at 08:58
2 answers
March 19th 20 at 09:00
Solution
Ready-made solutions do not know, but that's all you can do yourself rewriting logic. It is enough in the LoginController controller to override all the methods of AuthenticatesUsers and finish RegisterController methods create and validator. Thus you will be able to exclude login and password to write your own authorization logic by token.

For example: https://tighten.co/blog/creating-a-password-less-m...
Thank you! - okey commented on March 19th 20 at 09:03
March 19th 20 at 09:02
Solution
You want to implement an algorithm similar to ssh?

Do like this: add a middleware that will check for the cookie key and carry out the necessary manipulation to get the public key from the database, to inspect, decide the user is authorized or not.

However, I do not recommend to do so, it is better to use authorization on the basis of the JWT token.
More like cryptocurrency)), however, and saw on sites like this.

Tell me, is there some text on the topic

add middleware that will check for the cookie key


more detail (how to make a sequel I have some idea)

? - okey commented on March 19th 20 at 09:05
@okey, you're not gonna believe this, but the documentation contains text which reveals the theme. - Rebeca_Dooley42 commented on March 19th 20 at 09:08
@Rebeca_Dooley42, and we are not in the Church, to believe or not to believe.

Could just give a link to the relevant part of the documentation (where the benefit to each header anchor attached) - okey commented on March 19th 20 at 09:11
@Rebeca_Dooley42you to understand - I such your comments will be noted as "senseless" and send moderators. - okey commented on March 19th 20 at 09:14
@okey, you already promised to do it. Or didn't you?

Could just give a link to the relevant part of the documentation
Why? You still did not read it, and if you read, somehow selectively, skipping whole chunks. - Rebeca_Dooley42 commented on March 19th 20 at 09:17
@okey, I gave a link to the relevant key part of the documentation. - kathryn.Hil commented on March 19th 20 at 09:20
@okey, about the "read more" documentation elaborates on subject.

Create middleware, which is in accordance with the documentation shall contain metamod handle that accepts Illuminate\Http\Request $request, and $next, which is a Closure.

Next, from the object $request you can get the value of key $request->cookie('key'). Well continue working as you need. Or return $next($request) or redirecturl with a 401 error. - kathryn.Hil commented on March 19th 20 at 09:23
@kathryn.Hil, about links - I other participants in the debate))

Thank you! - okey commented on March 19th 20 at 09:26

Find more questions by tags LaravelCryptography