All Downloads are FREE. Search and download functionalities are using the official Maven repository.

authentication.extensionapp.InMemoryTokensRepository Maven / Gradle / Ivy

There is a newer version: 1.3.9
Show newest version
package authentication.extensionapp;

import model.AppAuthResponse;

import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;

public class InMemoryTokensRepository implements TokensRepository {

  private final Map tokens = new ConcurrentHashMap<>();

  @Override
  public AppAuthResponse save(AppAuthResponse appAuthResponse) {
    tokens.put(appAuthResponse.getAppToken(), appAuthResponse);
    return appAuthResponse;
  }

  @Override
  public Optional get(String appToken) {
    return Optional.of(tokens.get(appToken));
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy