
org.xlcloud.iam.IamUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of iam-utils Show documentation
Show all versions of iam-utils Show documentation
This module is provides set of base IAM utilities.
The newest version!
/*
* Copyright 2012 AMG.lab, a Bull Group Company
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.xlcloud.iam;
import com.iplanet.am.util.SystemProperties;
/**
* Set of utilities for IAM integration
*
* @author Jakub Wachowski, AMG.net
* @author Piotr Kulasek-Szwed, AMG.net
*/
public class IamUtils {
public static final String REST_SERVICE_NAME = "xlcRestAppl";
/**
* Reads ClientSDK property from AMConfig.properties
*
* @throws RuntimeException
* if property value is null or empty
*/
public static String getNonEmptyClientSdkProperty(ClientSdkProperty property) {
String value = SystemProperties.get(property.toString());
if (value == null || value.isEmpty()) {
throw new RuntimeException("Unable to read the " + property.toString() + " property.");
}
return value;
}
/**
* Reads ClientSDK property from AMConfig.properties
*/
public static String getClientSdkProperty(ClientSdkProperty property) {
return SystemProperties.get(property.toString());
}
/**
* Returns openam url (i.e. protocol://host:port/deploy_url) from ClientSDK
* configuration
*
* @return
*/
public static String getOpenAmUrl() {
return IamUtils.getNonEmptyClientSdkProperty(ClientSdkProperty.OPENAM_URL_PROTOCOL) + "://"
+ IamUtils.getNonEmptyClientSdkProperty(ClientSdkProperty.OPENAM_URL_HOST) + ":"
+ IamUtils.getNonEmptyClientSdkProperty(ClientSdkProperty.OPENAM_URL_PORT)
+ IamUtils.getNonEmptyClientSdkProperty(ClientSdkProperty.OPENAM_URL_DEPLOYMENT);
}
// do not allow to create instance of this class
private IamUtils() {
throw new AssertionError();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy