code: @Override
      public Optional<String> getTokenValue() {
          return getDetails().flatMap(details -> {
              String tokenValue;
              if (details instanceof OAuth2AuthenticationDetails) {
                  tokenValue = OAuth2AuthenticationDetails.class.cast(details).getTokenValue();
              } else {
                  throw new IllegalStateException("Unsupported token auth details type " + details.getClass());
              }
  
              return Optional.ofNullable(tokenValue);
          });
      }
docs: {@inheritDoc}