Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

238
Vistas
What type of security should I use in Spring REST application

I have a Spring REST application, and I'm thinking about what type of security to use. I'm considering between two options:

  1. Spring Security with OAuth2
  2. Spring Security with JWT like here https://www.toptal.com/java/rest-security-with-jwt-spring-security-and-java
  3. Any other option?

It must be good and secure enough for nowadays. Application is going to be a simple service or few small services. As a database I'm using MongoDB (probably it doesn't matter).

Maybe someone has some pros and cons of each type or any other suggestions what to use.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

First of all , your both points are same and point # 2 is incorrect as JWT is only a token format and not the actual security mechanism so both can't be compared.

OAuth2 server is the one which will generate token for you either in JWT or non-JWT format , that is your choice.

I am not sure about all the technologies out there but if you go by popularity, an OAuth2 as Authorization Server and JWT as token format are quite popular.

Application / API Security means lots of things and Authentication plus Authorization prevents lots of attacks. Obviously, not everything is a developer concern and most goes to infrastructure or security teams.

Flow

  1. Set up an Authentication Mechanism
  2. Set up an Authorization Mechanism ( OAuth2 ) connected to same User Source as Authentication mechanism. From here , you will get a token in JWT or non - JWT format. Getting token in JWT format has advantages that you can read on
  3. Now you set up a mechanism in your API project ( Usually Filters ) to parse and validate JWT token. Requests without valid tokens would be declined. This will force your clients to first authenticate themselves and retrieve a valid token to use your APIs.
  4. You can set up few more security in your API using Spring Security like XSS attacks, Cross Domain etc
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda