use of org.apache.oltu.oauth2.as.response.OAuthASResponse.OAuthAuthorizationResponseBuilder in project BIMserver by opensourceBIM.
the class OAuthAuthorizationServlet method makeUrl.
private URI makeUrl(String redirectURI, OAuthAuthorizationCode oauthCode, OAuthAuthorizationResponseBuilder builder) throws OAuthSystemException, URISyntaxException {
OAuthAuthorizationResponseBuilder build = builder.location(redirectURI).setParam("address", getBimServer().getServerSettingsCache().getServerSettings().getSiteAddress() + "/json");
build.setParam("serviceaddress", getBimServer().getServerSettingsCache().getServerSettings().getSiteAddress() + "/services");
if (oauthCode.getAuthorization() instanceof SingleProjectAuthorization) {
SingleProjectAuthorization singleProjectAuthorization = (SingleProjectAuthorization) oauthCode.getAuthorization();
build.setParam("poid", "" + singleProjectAuthorization.getProject().getOid());
} else if (oauthCode.getAuthorization() instanceof RunServiceAuthorization) {
RunServiceAuthorization auth = (RunServiceAuthorization) oauthCode.getAuthorization();
build.setParam("soid", "" + auth.getService().getOid());
}
final OAuthResponse response = build.buildQueryMessage();
String locationUri = response.getLocationUri();
URI url = new URI(locationUri);
return url;
}
Aggregations