org.swisspush.gateleen.routing.RouterConfiguration Maven / Gradle / Ivy
The newest version!
package org.swisspush.gateleen.routing;
import org.swisspush.gateleen.routing.auth.OAuthConfiguration;
import org.swisspush.gateleen.routing.auth.OAuthId;
import java.util.Map;
import java.util.Optional;
/**
* Container holding configuration values for the {@link Router}
*
* @author https://github.com/mcweba [Marc-Andre Weber]
*/
public class RouterConfiguration {
private final Integer requestHopsLimit;
private final Map oAuthConfigurations;
public RouterConfiguration(Integer requestHopsLimit, Map oAuthConfigurations) {
this.requestHopsLimit = requestHopsLimit;
this.oAuthConfigurations = oAuthConfigurations;
}
public Integer requestHopsLimit() {
return requestHopsLimit;
}
public Map oAuthConfigurations() {
return oAuthConfigurations;
}
public Optional oAuthConfiguration(String id) {
return Optional.ofNullable(oAuthConfigurations.get(OAuthId.of(id)));
}
}