Search in sources :

Example 1 with OIDProviderResponseBuilder

use of org.wso2.carbon.identity.discovery.builders.OIDProviderResponseBuilder in project identity-inbound-auth-oauth by wso2-extensions.

the class OIDCDiscoveryEndpoint method getResponse.

private Response getResponse(HttpServletRequest request, String tenant) {
    String response;
    OIDCProcessor processor = EndpointUtil.getOIDCService();
    try {
        OIDProviderResponseBuilder responseBuilder = getOidProviderResponseBuilder();
        response = responseBuilder.getOIDProviderConfigString(processor.getResponse(request, tenant));
    } catch (OIDCDiscoveryEndPointException e) {
        Response.ResponseBuilder errorResponse = Response.status(processor.handleError(e));
        return errorResponse.entity(e.getMessage()).build();
    } catch (ServerConfigurationException e) {
        log.error("Server Configuration error occurred.", e);
        Response.ResponseBuilder errorResponse = Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        return errorResponse.entity("Error in reading configuration.").build();
    }
    Response.ResponseBuilder responseBuilder = Response.status(HttpServletResponse.SC_OK);
    return responseBuilder.entity(response).build();
}
Also used : HttpServletResponse(javax.servlet.http.HttpServletResponse) Response(javax.ws.rs.core.Response) ServerConfigurationException(org.wso2.carbon.base.ServerConfigurationException) OIDCProcessor(org.wso2.carbon.identity.discovery.OIDCProcessor) OIDProviderResponseBuilder(org.wso2.carbon.identity.discovery.builders.OIDProviderResponseBuilder) OIDCDiscoveryEndPointException(org.wso2.carbon.identity.discovery.OIDCDiscoveryEndPointException) OIDProviderResponseBuilder(org.wso2.carbon.identity.discovery.builders.OIDProviderResponseBuilder)

Aggregations

HttpServletResponse (javax.servlet.http.HttpServletResponse)1 Response (javax.ws.rs.core.Response)1 ServerConfigurationException (org.wso2.carbon.base.ServerConfigurationException)1 OIDCDiscoveryEndPointException (org.wso2.carbon.identity.discovery.OIDCDiscoveryEndPointException)1 OIDCProcessor (org.wso2.carbon.identity.discovery.OIDCProcessor)1 OIDProviderResponseBuilder (org.wso2.carbon.identity.discovery.builders.OIDProviderResponseBuilder)1