use of org.forgerock.openam.services.baseurl.BaseURLProvider in project OpenAM by OpenRock.
the class OpenAMOAuth2UrisFactory method get.
/**
* Gets a OAuth2Uris instance.
*
* @param context TODO
* @param realmInfo The realm information.
* @return A UmaProviderSettings instance.
*/
@Override
public OAuth2Uris get(Context context, RealmInfo realmInfo) throws NotFoundException, ServerException {
String absoluteRealm = realmInfo.getAbsoluteRealm();
BaseURLProvider baseURLProvider = baseURLProviderFactory.get(absoluteRealm);
String baseUrl;
try {
baseUrl = baseURLProvider.getRealmURL(context.asContext(HttpContext.class), "/oauth2", absoluteRealm);
} catch (InvalidBaseUrlException e) {
throw new ServerException("Configuration error");
}
return get(absoluteRealm, baseUrl);
}
use of org.forgerock.openam.services.baseurl.BaseURLProvider in project OpenAM by OpenRock.
the class OpenAMOAuth2UrisFactory method get.
@Override
public OAuth2Uris get(HttpServletRequest request, RealmInfo realmInfo) throws NotFoundException, ServerException {
String absoluteRealm = realmInfo.getAbsoluteRealm();
BaseURLProvider baseURLProvider = baseURLProviderFactory.get(absoluteRealm);
String baseUrl;
try {
baseUrl = baseURLProvider.getRealmURL(request, "/oauth2", absoluteRealm);
} catch (InvalidBaseUrlException e) {
throw new ServerException("Configuration error");
}
return get(absoluteRealm, baseUrl);
}
use of org.forgerock.openam.services.baseurl.BaseURLProvider in project OpenAM by OpenRock.
the class DeviceCodeResourceTest method mockBaseUrlProvider.
private void mockBaseUrlProvider() {
BaseURLProvider urlProvider = mock(BaseURLProvider.class);
given(baseURLProviderFactory.get("REALM")).willReturn(urlProvider);
given(urlProvider.getRootURL(any(HttpServletRequest.class))).willReturn("BASE_URL");
}
Aggregations