Spring Security 5, Resource Server

An integration of Spring Security 5 OAuth2 server with Spring the old Spring Security OAuth2 Authorization Server

Catalin Patrut
3 min readMar 21, 2021

--

Image by https://unsplash.com/@jefflssantos

With the new Spring Security 5 release and to complete my other post about Spring and Oauth2 I came up with a new how to on how to configure and integrate end to end an authorization and authentication framework within Spring.

The OAuth2 server

The OAuth2 server is a spring application built around the spring-cloud-starter-oauth2. You may take the entire project from Gitlab (https://gitlab.com/blogging4t/auth ) and have a look over it.

The resource server

The resource server may be also found in Gitlab (https://gitlab.com/blogging4t/resource-server) and for a first run it is enough to run a docker-compose up -d within the root directory project. Provided that you have docker and docker-compose installed and you are logged into the Gitlab registry it should ran out of the box.

However, if you are not logged in, the following command will do it for you: docker login -u $CI_REGISTRY_USER -p $DOCKER_CI_TOKEN registry.gitlab.com

Resource Server Internals

--

--