Auth
Authentication and Authorization
Authentication and Authorization
Restdude applications are stateless by default and use Spring Security, a framework that focuses on providing both authentication and authorization to Java applications and can be easily extended to meet custom requirements. Spring Security supports varuous technologies out of the box, including in-memory, JDBC, LDAP, OAuth, SAML, Kerberos and others.
This document describes the core authentication and authorization mechanisms used in restdude.
To obtain a JWT Access token while authenticating, make an HTTP request as follows:
If the credentials are valid, you will receive a JSON response body with the corresponding user details and an access_token
cookie
that contains the compact, signed JWT Access token:
Add documentation
The following application properties control JWT generation:
restdude.jwt.accessTokenMinutes
: The amount of minutes JWT Access tokens are valid.restdude.jwt.refreshTokenMinutes
: The amount of minutes JWT Refresh tokens are valid. Should be greater than the above.restdude.jwt.tokenIssuer
: The token issuer.restdude.jwt.tokenSigningKey
: The secret key used to sign and verify JWTs.Restdude also supports Basic Authentication, mostly as a convenience during development.
To login and further access the app using Basic Auth, make an HTTP request as follows:
If the credentials are valid, you will receive a JSON response body with the corresponding user details and a restdude-sso
cookie
that iwill be the equivalent of an Authentication: Basic
header when transparently sent back to the server in subsequent requests:
Add documentation
Restdude provides transparent registration and social sign-in using Spring Social. Linkedin, Facebook, Github and other networks are supported.
Add documentation
Cookies are perhaps the most secure way of storing information on the client, provided SSL is used and cookies are configured as secure and HTTP-Only, i.e. not accessible by scripts. The following application properties control cookies configuration:
restdude.cookies.httpOnly
: true/false.restdude.cookies.secure
: true/false.Add documentation
Restdude supports both static and dynamic Cross-Origin Resource Sharing (CORS) configuration, the latter down to entity model instance.
Add documentation
Restdude allows configuring authorization by annotating your models using Spring Expression Language (SpEL) expressions.
Add documentation