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

org.entur.jwt.spring.TenantsProperties Maven / Gradle / Ivy

package org.entur.jwt.spring;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * 
 * Support for per-tenant additional custom properties / context data
 * 
 */

public class TenantsProperties {

    private Map issuers = new HashMap<>();
    private Map ids = new HashMap<>();
    
    public void add(TenantProperties properties) {
        if(ids.put(properties.getId(), properties) != null) {
            throw new IllegalStateException();
        }
        if(issuers.put(properties.getIssuer(), properties) != null) {
            throw new IllegalStateException();
        }
    }
    
    public TenantProperties getByIssuer(String issuer) {
        return issuers.get(issuer);
    }
    public TenantProperties getById(String issuer) {
        return issuers.get(issuer);
    }
    
    public Collection getAll() {
        return issuers.values(); 
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy