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

org.id4me.Id4meIdentityAuthorityStorage Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (C) 2016-2020 OX Software GmbH
 * Developed by Peter Höbel [email protected]
 * See the LICENSE file for licensing conditions
 * SPDX-License-Identifier: MIT
*/

package org.id4me;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.file.Path;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import org.json.JSONObject;
import org.slf4j.LoggerFactory;

/**
 * 
 * @author phoebel
 *
 */
public interface Id4meIdentityAuthorityStorage {

	static final org.slf4j.Logger log = LoggerFactory.getLogger(Id4meIdentityAuthorityStorage.class);
	static final Map storage = new ConcurrentHashMap<>();

	/**
	 * Return the registration data for an identity authority.
	 * 
	 * @param iau the identity authority domain
	 * @return Id4meIdentityAuthorityData, or null if not found.
	 * @throws FileNotFoundException if the file was not found
	 * @throws IOException           if any other I/O error occurred
	 */
	Id4meIdentityAuthorityData getIauData(Path authorityPath, String iau) throws IOException;

	/**
	 * Load the registration data from file.
	 * 
	 * @param iau the identity authority domain
	 * @return true, if the file exists and contains data, otherwise false
	 * @throws FileNotFoundException if the file was not found
	 * @throws IOException           if any other I/O error occurred
	 */
	boolean loadIauDataFromFile(Path authorityPath, String iau) throws IOException;

	/**
	 * Delete the registration data file if any exists and remove the data from the
	 * hash map.
	 * 
	 * @param iau the identity authority domain
	 */
	void removeIauData(Path authorityPath, String iau) throws IOException;

	/**
	 * Save the registration data to a file and in a private Hastable.
	 * 
	 * @param iau              the identity authority domain
	 * @param registrationData the registration data as JSONObject
	 * @return Id4meIdentityAuthorityData or null if not available
	 * @throws IOException
	 */
	Id4meIdentityAuthorityData saveRegistrationData(Path authorityPath, String iau, JSONObject registrationData)
			throws IOException;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy