![JAR search and dependency download from the Maven repository](/logo.png)
org.cloudfoundry.identity.uaa.oauth.KeyInfoBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cloudfoundry-identity-server Show documentation
Show all versions of cloudfoundry-identity-server Show documentation
Cloud Foundry User Account and Authentication
The newest version!
package org.cloudfoundry.identity.uaa.oauth;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
public class KeyInfoBuilder {
public static KeyInfo build(String keyId, String signingKey, String uaaUrl) {
if (StringUtils.isEmpty(signingKey)) {
throw new IllegalArgumentException("Signing key cannot be empty");
}
Assert.hasText(signingKey, "[Assertion failed] - this String argument must have text; it must not be null, empty, or blank");
signingKey = signingKey.trim();
if (isAssymetricKey(signingKey)) {
return new RsaKeyInfo(keyId, signingKey, uaaUrl);
}
return new HmacKeyInfo(keyId, signingKey, uaaUrl);
}
/**
* @return true if the string represents an asymmetric (RSA) key
*/
private static boolean isAssymetricKey(String key) {
return key.startsWith("-----BEGIN");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy