public OAuthPrincipal principal(String accessToken) throws CasOAuthException {

    OAuthPrincipal p = _accessTokenCache.get(accessToken);
    if (p != null) return p;
    try {
      OAuthClientRequest cr =
          new OAuthBearerClientRequest(casServerUrl + "oauth2.0/profile")
              .setAccessToken(accessToken)
              .buildQueryMessage();
      OAuthClient client = new OAuthClient(new URLConnectionClient());
      OAuthResourceResponse cres = client.resource(cr, "GET", OAuthResourceResponse.class);
      String body = cres.getBody();
      p = createJsonPrincipal(body, accessToken);
      _accessTokenCache.put(accessToken, p);
    } catch (Exception e) {
      throw new CasOAuthException("verifyCode", e);
    }
    return p;
  }
 public void removeFromServerStore(String key) {
   _serverStoreCache.removeKey(key);
 }
 public void putToServerStore(String key, OAuthPrincipal principal) {
   _serverStoreCache.put(key, principal);
 }
 public OAuthPrincipal getFromServerStore(String key) {
   return _serverStoreCache.get(key);
 }