

Currently, it is in draft status as RFC 7519. JWT (shortened from JSON Web Token) is the missing standardization for using tokens to authenticate on the web in general, not only for REST services.

Frameworks and languages are ready for these methods, having built-in functions to deal with each seamlessly. The other methods, on the other hand (session cookie, HTTP Basic and HTTP Digest) are well known to developers, and almost all browsers on all devices work with them out of the box. Consuming services from different providers required additional setup time, just to adapt to the specific token format used.
#SPRING DECODE JWT TOKEN HOW TO#
Every service provider had his or her idea of what to put in the token, and how to encode or encrypt it.

However, with such arbitrary tokens, there’s little standard involved. If implemented properly, it fixes all the security problems of HTTP Basic, HTTP Digest or session cookies, it is simple to use, and it follows the stateless pattern. This option seems to be the best we have, for now.
#SPRING DECODE JWT TOKEN PASSWORD#
Of course, they carried the same flaws found in websites: HTTP Basic had to be used over HTTPS since username and password are sent in easily reversible base64 encoding, and HTTP Digest forced the use of obsolete MD5 hashing that is proven to be insecure.įinally, some implementations used arbitrary tokens to authenticate clients. Both use an Authorization header to transmit user credentials, with some encoding (HTTP Basic) or encryption (HTTP Digest) added. In trying to get rid of client sessions from the server, some other methods have been used occasionally, such as Basic or Digest HTTP authentication. The trade-off is pretty slim security session hijacking and cross-site request forgery (XSRF) are the most common security issues. Compared to the WS-Security standard used for Web Services, it is much easier to create and consume REST services, hence convenience went through the roof. Besides ignoring the required statelessness, simplified approach came as an expected security trade-off. The stateless approach of REST makes session cookies inappropriate from the security standpoint, but nevertheless, they are still widely used. However, even now, many implementations still use cookie based authentication, which is inherited from standard website architectural design. Thus, the server replies to each request as if it was the first the client has made. It means the server does not keep any client state, with sessions as a good example. The simplified approach was applied to the security of REST services as well no defined standard imposes a particular way to authenticate users.Īlthough REST services do not have much specified, an important one is the lack of state. We can describe the REST service in a plain text file and use any message format we want, such as JSON, XML or even plain text again. REST (which stands for Representational State Transfer) services started off as an extremely simplified approach to Web Services that had huge specifications and cumbersome formats, such as WSDL for describing the service, or SOAP for specifying the message format.

Let’s try to examine the state of REST security today, using a straightforward Spring security tutorial to demonstrate it in action.
