use of org.forgerock.openam.core.RealmInfo in project OpenAM by OpenRock.
the class OpenAMOAuth2UrisFactory method get.
/**
* Gets a OAuth2Uris instance.
*
* @param request TODO
* @return A UmaProviderSettings instance.
*/
@Override
public OAuth2Uris get(final OAuth2Request request) throws NotFoundException, ServerException {
RealmInfo realmInfo = request.getParameter(RestletRealmRouter.REALM_INFO);
HttpServletRequest req = ServletUtils.getRequest(request.<Request>getRequest());
return get(req, realmInfo);
}
use of org.forgerock.openam.core.RealmInfo in project OpenAM by OpenRock.
the class OpenAMResourceSetStoreTest method setup.
@BeforeMethod
@SuppressWarnings("unchecked")
public void setup() throws Exception {
dataStore = mock(TokenDataStore.class);
OAuth2ProviderSettingsFactory providerSettingsFactory = mock(OAuth2ProviderSettingsFactory.class);
OAuth2UrisFactory<RealmInfo> oAuth2UrisFactory = mock(OAuth2UrisFactory.class);
OAuth2Uris oAuth2Uris = mock(OAuth2Uris.class);
TokenIdGenerator idGenerator = mock(TokenIdGenerator.class);
store = new OpenAMResourceSetStore("REALM", providerSettingsFactory, oAuth2UrisFactory, idGenerator, dataStore);
given(oAuth2UrisFactory.get(Matchers.<OAuth2Request>anyObject())).willReturn(oAuth2Uris);
given(oAuth2Uris.getResourceSetRegistrationPolicyEndpoint(anyString())).willReturn("POLICY_URI");
}
use of org.forgerock.openam.core.RealmInfo in project OpenAM by OpenRock.
the class RestletRealmRouter method getRealmFromURI.
private RealmInfo getRealmFromURI(Request request) {
RealmInfo realmInfo = (RealmInfo) request.getAttributes().get(REALM_INFO);
String subrealm = (String) request.getAttributes().get("subrealm");
if (subrealm != null && !subrealm.isEmpty()) {
if (realmInfo == null) {
throw new IllegalStateException("RealmInfo is null! Has not been set from server name");
} else {
return realmInfo.appendUriRealm(subrealm);
}
}
return null;
}
use of org.forgerock.openam.core.RealmInfo in project OpenAM by OpenRock.
the class RestletRealmRouter method getRealmFromServerName.
private RealmInfo getRealmFromServerName(Request request) {
String serverName = request.getHostRef().getHostDomain();
try {
SSOToken adminToken = coreWrapper.getAdminToken();
String orgDN = coreWrapper.getOrganization(adminToken, serverName);
return new RealmInfo(coreWrapper.convertOrgNameToRealmName(orgDN));
} catch (IdRepoException | SSOException e) {
throw new ResourceException(Status.SERVER_ERROR_INTERNAL, e);
}
}
use of org.forgerock.openam.core.RealmInfo in project OpenAM by OpenRock.
the class RestletRealmRouterTest method setUpServerName.
private void setUpServerName(Request request, SSOToken adminToken, String realm) throws IdRepoException, SSOException {
Reference reference = request.getResourceRef();
given(request.getHostRef()).willReturn(reference);
given(reference.getHostDomain()).willReturn("HOST_DOMAIN");
given(coreWrapper.getOrganization(adminToken, "HOST_DOMAIN")).willReturn("REALM_HOST_DN");
given(coreWrapper.convertOrgNameToRealmName("REALM_HOST_DN")).willReturn(realm.equals("/") ? realm : "/" + realm);
request.getAttributes().put(RestletRealmRouter.REALM_INFO, new RealmInfo("/"));
}
Aggregations