This still needs to be thought through a bit, but contracts like these:

public class AbstractOAuth2TokenAuthenticationToken<T extends AbstractOAuth2Token>

would be a bit more flexible if the bounding type were an interface instead of an abstract class, for example:

public class AbstractOAuth2TokenAuthenticationToken<T extends OAuth2Token>

Or, perhaps something more generic:

public class AbstractOAuth2TokenAuthenticationToken<T extends Token>

These would imply the creation of an interface for AbstractOAuth2Token to extend, something like:

public interface Token {
    String getValue();
}

public abstract class AbstractOAuth2Token implements Token {
   // ...
}

Logging this ticket so that we can start the discussion.

Comment From: jgrandja

Extracted the new interface OAuth2Token from AbstractOAuth2Token, which would benefit OAuth2Tokens that was recently introduced in spring-authorization-server#137.