스프링 시큐리티 OAuth2의 기본 개념부터 API 사용법과 내부 아키텍처를 학습합니다. 아울러 OAuth2 Client, OAuth2 Resource Server, Authorization Server를 통합하여 연동하는 방법을 살펴보고 자체 인가 서버를 구축하며 이를 통해 OAuth2 서비스를 구현하는 방법을 학습하게 됩니다.
막강한 인증/인가 처리를 위한 최선의 선택! 제대로 배우는 스프링 시큐리티 OAuth2 🔐
스프링 시큐리티 OAuth2?
Spring Security OAuth2는 OAuth 2.0 Authorization Framework 표준 기술 사양을 채택하여 OAuth2 Client, Resource Server, Authorization Server 군으로 분류하여 API를 제공하고 있습니다.
전통적인 세션 기반 인증 방식의 강력한 대안
과거부터 현재에 이르기까지 레거시 시스템의 전통적인 인증 및 인가 방식으로 세션/쿠키를 활용한 기술을 많이 사용하고 있습니다. 그러나 시스템의 규모가 커지고 모바일, 태블릿, PC, IOT 등 다양한 기기의 인증 처리를 하는 데 있어 세션 공유 문제나 서버 자원 부담, 보안 안전성, 복잡한 아키텍처 구성 등 기존 세션 방식의 인증 구성이 여러 문제와 한계를 지닌 것으로 인식되고 있습니다.
특히 모놀리틱이 아닌 MSA 방식의 인프라가 점점 추세가 되고 있는 현시점에서는 더더욱 세션 기반 인증방식이 효율적인 대안이 되지 못하는 것도 사실입니다.
이에 위 한계점과 문제들을 해결하기 위한 방식으로 세션이 아닌 토큰 방식으로 인증/인가처리를 하기 위한 필요성이 대두되어 OAuth, JWT와 같은 인증 처리 기술들이 탄생했습니다. 이리하여 글로벌 기업인 구글, 페이스북, 깃헙에서 서비스하는 OAuth 서비스를 활용해 더욱 간결하고 강력한 인증/인가 처리를 할 수 있게 되었습니다.
본 강의는 스프링 시큐리티 OAuth2 지식을 처음 접하는 입문자부터 기초적인 지식이나 사용 경험은 있지만 좀 더 깊이 있는 지식 습득과 스프링 시큐리티 OAuth2의 핵심 원리, 내부 구조, 동작 방식 등을 심도 있게 이해하고 이를 응용하고자 하는 중~고급자 분들을 위해 제작되었습니다.
스프링 시큐리티 OAuth 핵심 이해 강의는
🔑
단순한 API 사용법과 문법만을 학습하지 않습니다. 인가 기술의 원리와 구조를 토대로 핵심 기술에 대한 이해를 높입니다.
🎓
스프링 시큐리티 OAuth2가 어떤 구조로 동작하는지 정확한 흐름들을 이해하고 원리를 파악하도록 합니다.
🧰
스프링 시큐리티 OAuth2가 제공하는 기본 기능을 확장하여 커스터마이징하는 역량을 기를 수 있습니다.
✅
스프링 시큐리티 OAuth2의 기술을 어떻게 실무적으로 활용할 수 있을지에 대한 감각을 익히게 됩니다.
주요 학습 내용
💡 본 강의는 OAuth 2.0 표준 기술과 이를 바탕으로 한 스프링 시큐리티 OAuth2의 핵심 개념인 OAuth2 Client, Resource Server, Authorization Server의 세 가지 축을 중심으로 수업을 진행합니다.
1) OAuth 2.0 Authorization Framework
RFC 표준 기술인 OAuth 2.0 인가 프레임워크의 전반적인 개념과 원리, 구조 등의 내용을 살펴봅니다.
스프링 시큐리티 OAuth2의 본격적인 기술을 학습하기에 앞서 OAuth 2.0 의 표준 기술에 대한 기초와 기본적인 이론을 먼저 이해하고, 실습을 통해 정확한 개념을 숙지함으로서 스프링 시큐리티 OAuth2의 내용을 어려움 없이 따라갈 수 있도록 합니다.
2) OAuth2 Client
OAuth 2.0 의 클라이언트 모듈로서 클라이언트에서 인가 서버와 연동할 수 있는 여러 유형의 권한 부여 타입과 요청 API를 소개하며 인가서버로부터 발급받은 토큰을 사용하여 리소스 서버로의 접근제어를 어떻게 구현하는가에 대한 내용을 학습합니다.
또한 구글, 페이스북, 깃헙, 네이버 , 카카오 등 OAuth 2.0 Authorization Server 서비스 제공자와의 연동을 통해 소셜 로그인 기능을 구현하는 방법을 소개합니다. 그리고 인증 프로토콜인 OpenID Connect 를 소개하며 인증 처리를 위한 다양한 옵션 설정방법과 흐름을 이해합니다.
3) OAuth2 Resource Server
사용자의 자원을 보호하고 있는 서버로서 API 서버의 역할을 수행하게 됩니다. 리소스 서버가 자원을 보호하는 방법을 살펴보고 Access Token을 포함한 요청에 대해서 토큰의 유효성을 검증하는 방법과 권한 체계를 제어하는 흐름에 대해 학습합니다.
OAuth2 서비스 제공자에서 발급하는 Access Token이 JWT 포맷으로 생성된 토큰일 경우 Scope(범위) 를 추출하는 내용을 살펴보고 리소스 서버에서 Access Token에 포함된 Scope를 분석하여 권한 여부를 어떻게 판별하는지 내용을 학습합니다.
4) OAuth2 Authorization Server
시중에는 오픈소스를 포함한 다양한 Authorization Server 상용 제품 및 서비스가 있습니다. 스프링 시큐리티 개발팀에서 Authorization Server 프레임워크 프로젝트를 중단하기도 했지만 수많은 개발자들의 빗발치는 요청으로 Authorization Server 프로젝트가 완전히 새로운 설계로 다시금 탄생했습니다.
본 강의에서는 새로운 아키텍처로 재탄생한 Authorization Server 프로젝트를 기준으로 강의를 제작했습니다. OAuth2 Client와 Resource Server와의 연동을 통한 인가서버로서의 기능에 대한 상세한 내용을 살펴보며 자체적으로 인가 서버를 구축하여 서비스할 수 있는 지식을 갖추도록 하는 데 중점을 두었습니다.
Authorization Server 기능을 처리하는 주요 클래스를 알아보고 커스터마이징할 수 있는 방법을 알아봅니다. 또한 OAuth 2.0 표준 엔드 포인트에 대한 사양을 살펴보고 각 엔드포인트마다 설정된 필터들의 구조와 처리 과정을 학습합니다.
아키텍처/흐름/원리를 두루 이해할 수 있습니다.
스프링 프레임워크 프로젝트 가운데 스프링 시큐리티는 기술 아키텍처, 동작원리, 흐름 이해 등의 내부 소스 레벨의 구현에 대한 전반적인 이해가 굉장히 중요합니다.
주어진 API 위주로 사용하다가 예기치 못한 오류나 이슈에 부딪치게 되면 구글에 검색해서 해결방안을 찾기 마련입니다. 그러나 스프링 시큐리티 OAuth2 에 관한 자료들이 많지 않고 대부분 비슷한 사례들이 반복해서 나오는 수준이기 때문에 스프링 시큐리티 OAuth2의 내부 구조와 동작 원리를 정확하게 이해하지 못하거나 분석이 되지 못한다면 서비스 운영에 많은 어려움을 겪게 됩니다.
그렇기 때문에 이번 강의는 다양한 도식 및 Flow와 디버깅을 통한 정확하고 상세한 설명을 통해 단순한 API 사용법과 기능 예제를 넘어 스프링 시큐리티 OAuth2의 구조와 흐름을 완전하게 분석하고 이해함으로서 어떤 상황에서도 유연한 대처가 가능한 지식을 갖추도록 하는 데 중점을 두고 있습니다. 이는 본 강사가 개설한 강의들의 패턴 및 공통적인 특징이라 할 수 있습니다.
강의 구성 및 상세 커리큘럼
Part 1. 스프링 부트 기반으로 개발하는 스프링 시큐리티
스프링 시큐리티의 핵심 개념인 인증과 인가의 두 축을 중심으로 강의가 진행됩니다. 스프링 시큐리티의 기초와 기본이 굉장히 중요하기 때문에 Part. 1에서는 스프링 시큐리티를 구성하는 핵심 구조 및 인증, 그리고 인증과 관련된 주요 항목들에 대한 정확한 개념을 이해하고 예제와 실습을 통해 실무적인 개발에 도움이 되도록 구성했습니다.
Part. 1을 수강하게 되면 스프링 시큐리티의 전체적인 Fundamentals을 확실하게 정립함과 동시에 더 나아가 보안 시스템 구축 시 시큐리티 기본구조를 확장하고 응용이 가능한 수준의 역량을 기르게 됩니다.
Part 2. 스프링 부트 기반으로 개발하는 스프링 시큐리티 OAuth2
OAuth2의 기본 개념과 흐름의 정확한 이해와 스프링 시큐리티 OAuth2의 핵심 모듈인 OAuth2 Client, Resource Server, Authorization Server의 기술에 대해 학습합니다. Part. 2를 원활하게 학습하기 위해서는 Part. 1의 기본 내용에 대한 이해가 필수이기 때문에 반드시 사전에 지식을 습득한 후 수강해야 합니다.
Part. 2에서는 OAuth2에 관한 다양한 기술들이 복합적으로 구성되어 있기 때문에 방대한 OAuth2 관련 개념을 충분히 이해하고 이를 바탕으로 클라이언트 앱, 리소스 서버, 인가서버 상호간의 연동 과정을 상세하고 깊이 있게 분석하고 살펴봅니다.
Spring Security Fundamentals
스프링 시큐리티의 핵심 기초를 살펴봅니다. 초기화 과정에 대한 자세한 내용과 원리를 알아보고 HttpBasic, Cors와 같은 요소를 다룹니다.
OAuth 2.0 Authorization Framework
OAuth 2.0 표준 기술에 대한 상세 사양에 대해 학습합니다. OAuth 2.0에서 표현되는 다양한 용어를 먼저 이해하고 권한부여 흐름의 타입에 대한 개념 정리와 keycloak 오픈 소스를 활용해 인가 프레임워크의 전반적인 흐름을 이해합니다.
OAuth 2.0 Client - oauth2Login()
클라이언트 앱의 기능을 자동화하며 권한부여 흐름의 타입인 Authorization Code 방식으로 인가서버와의 연동방법을 학습하며 사용자 승인과 승인 이후 Access Token 을 받아와 인증/인가 처리에 이르기까지의 전 과정을 살펴보고 내부구조에 대해 학습하게 됩니다.
OAuth 2.0 Client - oauth2Client()
oauth2Login() API에서 제공하는 권한부여 흐름의 타입인 Authorization Code 외에 Resource Owner Password와 Client Credentials 타입으로 인가서버와 연동하는 방법을 살펴보며 DefaultOAuth2AuthorizedClientManager, @RegisteredOAuth2AuthorizedClient의 사용방법을 알아보고 이를 통해 클라이언트 권한부여 흐름을 이해합니다.
OAuth 2.0 Client - OAuth 2.0 Social Login
OAuth2 서비스 제공자로 구글, 페이스북, 깃헙, 네이버, 카카오 등이 있는데 이중 구글, 네이버, 키클록을 사용하여 로그인 인증하는 방식과 인증 이후 후속처리에 대한 구현방법을 살펴봅니다.
OAuth 2.0 Resource Server API - jwt()
리소스 서버를 구성하는 방법과 Access Token 요청을 처리하는 JwtDecoder의 기능을 살펴보고 토큰 검증의 성공이후 생성되는 인증관련 객체의 구조와 사용방법을 학습합니다. 또한 Access Token의 유효성을 검증할 때 사용되는 MAC & RSA 알고리즘 방식이 무엇이며 어떤 처리절차에 의해 검증이 이루어지는지 살펴봅니다.
OAuth 2.0 Resource Server - 리소스 서버 권한 구현
Access Token 요청을 처리하는 필터와 JwtDecoder에 의해 추출된 Scope를 권한으로 변환하고 변환된 권한으로 자원의 접근여부를 제어하는 방법에 대해 학습합니다.
OAuth 2.0 Resource Server - opaque()
원격 토큰 검사 프로세스로서 Access Token의 활성화 여부를 인가서버와 직접 통신하여 알아보는 방법을 학습합니다.
Spring Authorization Server - 주요 도메인 클래스
인가서버를 구성하는 주요 도메인 클래스의 종류와 개념, 역할 등을 학습하며 이 클래스들이 스프링 MVC에서 어떤 방식으로 참조 및 활용이 가능한지 학습합니다.
Spring Authorization Server - 엔드포인트 프로토콜
인가서버의 핵심 기능인 여러 유형의 엔드포인트 프로토콜에 대해 학습합니다. 권한 부여 요청을 시작한 엔드포인트 부터 사용자 정보를 요청하는 엔드포인트까지의 전 과정을 도식과 흐름을 통해 자세하게 살펴보게 됩니다.
OAuth 2.0 Client + Resource Server + Authorization Server 연동
스프링 시큐리티에서 제공하는 각 OAuth2의 모듈들을 연계 및 연동하는 방법을 알아보고 이를 통해 OAuth2 서비스 제공자로서의 기능을 수행하는 구체적인 항목들을 예제를 통해 살펴보게 됩니다.
다양한 프로젝트에서 웹/모바일/솔루션 제품 개발과 관련된 업무를 진행해 오고 있으며 분석/설계/개발 Role 을 맡아 오고 있습니다.
공공기간, 교육프로그램, 기업 프로젝트, 쇼핑몰 등의 웹 개발 및 솔루션 프로그램, 프레임워크, 오픈소스 연동 등의 아키텍처 설계 및 구조적 고도화 개선 등을 해 오고 있으며 개발, PL 등의 역할을 맡았습니다.
다양한 Open Source 와 여러 기술적인 경험들을 통해 웹의 전반적인 기술 흐름들을 익혔으며 개발 경험이 거듭될 수록 요구사항의 기능 구현에만 거치지 않고 좀 더 OOP 적인 구조의 소프트웨어로서 안전성과 성능을 고려한 아키텍처링과 튜닝의 기술들을 접목시켜 지속적으로 더 훌륭한 소프트웨어를 완성하기 위한 연구와 개발 실무를 책임감 있게 맡아 오고 있습니다.
Hello. I listened to the lecture on security and OAUTH2 well.
I can feel that the instructor prepared the lecture a lot and is passionate.
And he is also a very knowledgeable person.
However, I think it would be good if the teaching method was improved a bit.
1. I feel like the explanation is a bit rushed. This is a bit awkward, but I think that calmly leading the lecture can reduce awkwardness. Sometimes, I skipped over the words without knowing what they were because of the pronunciation.
2. The lecture structure is difficult for students to learn proactively. Basically, you have no choice but to follow along. In such a situation, if the instructor and students are not properly synchronized, and the instructor and the students have different contexts, the students become very stressed. I sometimes see emotional posts expressing complaints about this in the community. I understand the feelings a little. This is because most of the students who purchase the lecture start taking the lecture with high expectations.
From the instructor's perspective, something that is so obvious (the more years you have and the more knowledge you have, the stronger this tendency becomes), but from the student's perspective, it is often not the case at all.
3. For example, it was good to practice authorization requests with Postman and then move to Spring. Well, since the speed of the speech is fast without any special points, it feels like important stories are flowing by. For example, when requesting authorization for the first time, when you press the login button, the client requests /oauth2/authorization, and when the client requests a temporary code from the authorization server, it goes down to /oauth2/authorize, but since this just happens, I couldn't recognize it for a while. It was quite confusing and confusing for a long time. So I got used to it by debugging it one by one. I think it may be because the instructor is so familiar with it, but when you are teaching, you say, "This URL may be a bit confusing. The initial login is /oauth2/authorization, and the code request is /oauth2/authorize. In reality, the authorization process starts when the client requests a code, so authorize means granting permission, so /oauth2/authorize is the URL for requesting a code. In this context, it would be good to remember it." If you explain it once, it will be a very helpful point for students.
4. When proceeding with the next chapter lecture, there are many cases where you proceed with new code (from the beginning). I think it is the same reason why someone asked to maintain the code in the course review. It is definitely convenient because Younghan leaves all the code after the first lecture. The process is carried out without editing, so just watching and following it together can be a learning experience, and it is advantageous because students and instructors can be on the same page.
You can start from a new branch every time like Suwon Instructor, but I think it would have been good if there had been just one guide at the beginning of the lecture. Each clip or section is managed as a branch unit, so if possible, I ask the students to do the same. There may be some beginners in Git. You only need to show it once. Since you are not going to merge PRs into master, if you just show them how to create a new branch, the students will be on the same page as you.
5. Lastly, I think it would have been better to explain Filter -> Manager -> Provider -> before the actual lecture started. They mentioned it in the latter half of the lecture. I realized that the pattern was set while listening to the lecture, but it would have been easier if I had known the pattern at the beginning. It may be less so in other lectures, but Security has so many classes and the depth is so deep that it is a bit confusing to follow the lecture, and I get lost even while following the lecture. Of course, the instructor explains the flow with class diagrams at the beginning, but when the screen is filled with classes with long names that I have never seen before... the flow is not immediately apparent. Of course it helps, but I still don't think I'm on the same page as the students.
6. Oh, and you clearly said that you would save it in the database during the final practice instead of saving it in memory, but I was a little disappointed that you forgot and ended the practice with in-memory. This is a small thing, but it would have been better if you had named the resource server as ResourceServerPhoto instead of 1, 2 during the final practice. When I was taking a C++ class in the past, the instructor said, "It might be boring or not fun because it's the same example every time (the example was written by putting the name, age, and a few other pieces of information in the Person class), but since you have a lot to learn in the future, the hurdle for newness in this area should be low so that it's easy to learn." I remember that.
I like what Einstein said, that when explaining, you should make it so that even a grandmother without relevant knowledge can understand, so I wrote down a lot of thoughts about teaching methods.
Nevertheless, students, Security and this lecture are great guides for understanding the in-depth inside of the security framework. I now know almost everything about where and how to set breakpoints when debugging. If the breakpoints don't go where I thought they would, I can figure out the right flow by looking around more. Security and OAUTH2 are definitely not easy lectures, but I think they are lectures that you can gain a lot from if you put in the effort.
I'm learning well. Thank you.
I am so touched that you have given me such a thorough lecture evaluation.
And I am so grateful for your sincere advice.
I will do my best to refer to the items you mentioned when creating the lecture.
However, I would appreciate it if you could be generous and understand that there may be shortcomings in various ways, even though I said that habits are scary.
Regardless of career or years of experience, I always try to look at myself with a humble attitude, thinking that there are many more excellent developers in the world than you think.
Although I am an instructor at Inferun, I do not think that instructors are in a position to teach because they are better or more capable than their students.
Of course, it is natural that instructors should try to provide the best quality to students, but it is not necessarily because they have more outstanding skills or abilities, but because there are people who need the knowledge that instructors know, and I always prepare the lecture with the thought that there will be developers among the students who are better than the instructor.
I still do not have many of the requirements of a professional instructor, so there are many areas that are lacking or need improvement, so I always think about them and make efforts to improve them when creating the lecture. Once again, thank you for your sincere advice and support. I will always strive to be an instructor who prioritizes my students so that they will never be disappointed, rather than prioritizing personal interests. Thank you.
It is definitely a really good lecture.
I am listening to everything from Spring Batch > Security > OAuth2.
Since everyone else has mentioned the advantages, I would like to tell you about my suggestions(?) or regrets.
I thought it would be helpful to check all the source code levels of Spring in debugging mode. Of course, the instructor checks by setting breakpoints in advance, but it doesn't seem easy to follow the screen that passes by quickly.
Of course, if you say that you have to know everything to use a certain technology!!, I have nothing to say, but I think the lecture would be more compact and cost-effective if the instructor explains the theory part and ends by quoting some source code. It is definitely a good lecture, but it takes a lot of time to learn everything, including the debugging process, and if you take this lecture to use it in practice right away, you might think that you should postpone applying it to practice.
I am leaving a review in the hope that the instructor will continue to make better lectures in the future.
Yes, thank you for your sincere evaluation^^
As you said, showing the source level processing process using debugging in the lecture may not be a necessary element in some sense.
The lecture time is relatively longer, and there are also things that are not easy to understand even after seeing the debugging process once. Nevertheless, the reason for including debugging elements in the lecture is to help you clearly understand the internal processing of the framework or library.
Of course, you do not need to know the internal processes and flow of all modules and APIs, and you cannot know them.
From my perspective, if it is determined that knowing the internal processing process is important when implementing a function, I explain the overall processing process through debugging.
Debugging does not mean that it ends with debugging itself.
The purpose is to develop the ability to extend or apply the API as I want, beyond simply using it, by clearly understanding the purpose and principles of the design of the API through debugging.
Although we did not design or create Spring Security directly, it is a good way to indirectly participate in the design of the core technology through debugging and partially experience the principles of implementation.
If this process is repeated and accumulated, not only the basic use of the API but also a deep understanding of the technology will be possible, and complex custom applications will be possible, and you will be able to respond quickly when exceptions or issues occur.
However, if you look too closely at the source level, you will miss the whole picture. Because it can be done, you should take the method of analyzing and adjusting it according to your level and understanding ability.
I will continue to think about how to incorporate debugging utilization at an appropriate level into the lecture through speed adjustment and develop it.
Thank you again for your valuable evaluation^^
It explains it in great detail.
It shows the debugging process, so it's much more memorable.
I think I need to do this much to be able to say I've used OAuth 2.0.
If you keep doing it consistently, there will come a moment when even the most difficult things will be solved smoothly.
I hope you overcome those hardships well.
Thank you for your valuable feedback.^^
Thank you for the great lecture :)
I was trying to listen to Udemy because there were no proper security-related lectures in Korean, and it seems like the perfect lecture came out at the perfect time!! I've only listened to about 1/5 of it so far.. but it's a really informative lecture!! I'm very satisfied :)
I am glad that the long-awaited lecture has been released, so I am happily registering for the class and studying hard.
I am taking the class while thinking about the understanding of the OAuth2 standard and how Spring Security implemented the code, and it is very helpful.
It is actually a little difficult, but I hope that I can persevere to the end and grow personally.
Thank you so much for the great lecture. Stay healthy^^
Yes, thank you^^
As you said, if you learn the technology of Spring Security OAuth2 that complies with the OAuth2.0 standard specification, you will acquire the concept of OAuth2.0 almost like a professional before you know it.
This is because the technical perfection of Spring Security's OAuth2.0 is that high.
The overall technical difficulty may not be easy, but I hope you complete it to the end and have good results~~