    001// License: GPL. For details, see LICENSE file.
    002package org.openstreetmap.josm.plugins.streetside.oauth;
    003
    004
    005import java.util.Map;
    006
    007import org.openstreetmap.josm.plugins.streetside.utils.StreetsideProperties;
    008
    009/**
    010* Represents the current logged in user and stores its data.
    011*
    012* @author nokutu
    013*
    014*/
    015public final class StreetsideUser {
    016
    017private static String username;
    018private static String imagesPolicy;
    019private static String imagesHash;
    020/** If the stored token is valid or not. */
    021private static boolean isTokenValid = true;
    022
    023private StreetsideUser() {
    024 // Private constructor to avoid instantiation
    025}
    026
    027/**
    028* @return The username of the logged in user.
    029*/
    030public static synchronized String getUsername() {
    031   // users are not currently supported in Streetside
    032   return null;
    033}
    034
    035/**
    036* @return A HashMap object containing the images_policy and images_hash
    037*         strings.
    038*/
    039public static synchronized Map<String, String> getSecrets() {
    040  // secrets are not currently supported in Streetside
    041  return null;
    042}
    043
    044/**
    045* Resets the MapillaryUser to null values.
    046*/
    047public static synchronized void reset() {
    048 username = null;
    049 imagesPolicy = null;
    050 imagesHash = null;
    051 isTokenValid = false;
    052 StreetsideProperties.ACCESS_TOKEN.put(StreetsideProperties.ACCESS_TOKEN.getDefaultValue());
    053}
    054
    055public static synchronized void setTokenValid(boolean value) {
    056 isTokenValid = value;
    057}
    058}