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

org.cloudfoundry.identity.uaa.oauth.TokenEndpointBuilder Maven / Gradle / Ivy

There is a newer version: 4.30.0
Show newest version
package org.cloudfoundry.identity.uaa.oauth;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.cloudfoundry.identity.uaa.util.UaaTokenUtils;

import java.net.URISyntaxException;
import java.net.URL;

public class TokenEndpointBuilder {
    private final Log logger = LogFactory.getLog(getClass());
    private String issuer;

    public TokenEndpointBuilder(String issuerUrlBase) throws Exception {
        setIssuer(issuerUrlBase);
    }

    public String getTokenEndpoint() {
        try {
            return UaaTokenUtils.constructTokenEndpointUrl(issuer);
        } catch (URISyntaxException e) {
            logger.error("Failed to get token endpoint for issuer " + issuer, e);
            throw new IllegalArgumentException(e);
        }
    }

    public String getIssuer() {
        return issuer;
    }

    public void setIssuer(String issuer) throws Exception {
        new URL(issuer); // validate issuer url is valid
        this.issuer = issuer;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy