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

com.microsoft.alm.storage.InsecureInMemoryStore Maven / Gradle / Ivy

// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See License.txt in the project root.

package com.microsoft.alm.storage;

import com.microsoft.alm.secret.Secret;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

public class InsecureInMemoryStore implements SecretStore {

    private final ConcurrentMap store;

    public InsecureInMemoryStore() {
        store = new ConcurrentHashMap();
    }

    @Override
    public E get(final String key) {
        return store.get(key);
    }

    @Override
    public boolean delete(final String key) {
        if (store.containsKey(key)) {
            return store.remove(key) != null;
        }

        return true;
    }

    @Override
    public boolean add(final String key, final E secret) {
        return store.put(key, secret) != null;
    }

    @Override
    public boolean isSecure() {
        return false;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy