Can the new Spring Authorization Server generate tokens other than JWT and Opaque?

Viewed 33

I am currently migrating the authorization server from old Spring Security OAuth2 to the new Spring Authorization Server.

It seems that the new Spring Authorization Server generates JWT tokens by default.

What if I dont want to use JWT and Opaque.

Is it possible to generate tokens same as the old Spring Security OAuth2?

By the way, I also dont have idea what type of token the old Spring Security OAuth2 generates...i am a noob here...any idea is appreciated.

Thanks.

1 Answers

You can generate any type of token you want, using OAuth2TokenGenerator, though it sounds like you don't have another type in mind.

Spring Authorization Server supports OAuth2TokenFormat.SELF_CONTAINED and OAuth2TokenFormat.REFERENCE as types, which are high level categories that map concretely to JWT and Opaque respectively. If you aren't interested in using a JWT, then I suggest using Opaque. It is quite simple to configure and use.

If you want to use another self-contained format, there are many areas of the framework you will need to customize and get right, which might be difficult without a spec. I don't remember off hand what formats were supported by the old project, but it was likely one or both of these.

Related