IT story

마이크로 서비스 인증 전략

hot-time 2020. 7. 19. 09:15
반응형

마이크로 서비스 인증 전략


마이크로 서비스 아키텍처를위한 적절한 / 보안 인증 전략을 선택하는 데 어려움을 겪고 있습니다. 이 주제에서 찾은 유일한 SO 게시물은 다음과 같습니다 .Microservice Architecture의 싱글 사인온

내 생각은 각 서비스 (예 : 인증, 메시징, 알림, 프로필 등)에서 각 사용자에 대한 고유 한 참조 (논리적으로 그 다음에 그의 것 user_id)와 현재 사용자의 id로그인 가능성을 얻는 것 입니다.

연구 결과 두 가지 가능한 전략이 있습니다.

1. 공유 아키텍처

공유 아키텍처

이 전략에서 인증 앱은 다른 서비스 중 하나입니다. 그러나 각 서비스는 변환 session_id=>을 수행 user_id할 수 있어야하므로 간단해야합니다. 그래서 Redis에 대해 생각한 이유는 key : value 저장하는 것 session_id:user_id입니다.

2. 방화벽 아키텍처

방화벽 아키텍처

이 전략에서 세션 저장소는 인증 앱에서만 처리되므로 실제로 중요하지 않습니다. 그러면 user_id다른 서비스로 전달 될 수 있습니다. Rails + Devise (+ Redis 또는 mem-cached 또는 쿠키 스토리지 등)를 생각했지만 많은 가능성이 있습니다. 중요한 것은 Service X가 사용자를 인증 할 필요가 없다는 것입니다.


이 두 솔루션은 다음과 같은 관점에서 어떻게 비교됩니까?

  • 보안
  • 견고성
  • 확장 성
  • 사용의 용이성

아니면 내가 여기서 언급하지 않은 다른 해결책을 제안 할 것입니까?

나는 솔루션 # 1을 더 좋아하지만 올바른 방향으로 가고 있다는 사실을 보장하는 많은 기본 구현을 찾지 못했습니다.

내 질문이 닫히지 않기를 바랍니다. 물어볼 다른 곳은 정말 모르겠습니다.

미리 감사드립니다


내가 이해 한 것을 기반으로, 그것을 해결하는 좋은 방법은 OAuth 2 프로토콜을 사용하는 것입니다 ( http://oauth.net/2/ 에서 조금 더 자세한 정보를 찾을 수 있습니다 )

사용자가 응용 프로그램에 로그인하면 토큰을 얻을 수 있으며이 토큰을 사용하면 다른 서비스로 보내 요청에서 식별 할 수 있습니다.

OAuth 2 모델

체인 마이크로 서비스 디자인의 예 건축 모형

자원:


Short answer : Use Oauth2.0 kind token based authentication, which can be used in any type of applications like a webapp or mobile app. The sequence of steps involved for a web application would be then to

  1. authenticate against ID provider
  2. keep the access token in cookie
  3. access the pages in webapp
  4. call the services

Diagram below depicts the components which would be needed. Such an architecture separating the web and data apis will give a good scalability, resilience and stability

여기에 이미지 설명을 입력하십시오


you can use idenitty server 4 for authentication and authorisation purpose

you must use Firewall Architecture hence you have more control over secutiry , robustness ,scalability and ease of use


API gateway pattern should be used to implement this using OpenID Connect. User will be authenticated by IDP and will get the JWT token from authorization server. Now API gateway system can store this token in Redis database and set the cookie on the browser. API gateway will use the cookie to validate the user request and will send the token to the Microservices.

API Gateway acts as a single entry point for all types of clients apps like public java script client app, traditional web app, native mobile app and third party client apps in the Microservice architecture.

You can find more details about it on http://proficientblog.com/microservices-security/

참고URL : https://stackoverflow.com/questions/29644916/microservice-authentication-strategy

반응형