0

I'm writing REST app with spring boot.

I wanted to implement authentication througn basic auth with login and password manually (without using of the spring security)

How can I get login and password in an controller from basic auth data of the rest request?

Please, don't suggest to use spring security, I know it.

  • 1
    Isn't it duplicate of https://stackoverflow.com/questions/61723119/login-without-spring-security – hillel_guy May 04 '22 at 08:15
  • 1
    Can we not use `SecurityContextHolder` to get the context and read credentials? e.g, `SecurityContextHolder.getContext().getAuthentication().getCredentials();` – Ganesh Thorat May 04 '22 at 15:53
  • 1
    Ok. You don't want to use spring security then this might help you https://stackoverflow.com/a/12342227/10553411 – Ganesh Thorat May 04 '22 at 16:00

1 Answers1

0

I found the solution which is related with creation of custom filter. Inside the filter you can get access to the request and get the header from it. The header contains encrypted login and password. You can decript it and get login and password.