Search in sources :

Example 1 with AuthorizationGenerator

use of org.pac4j.core.authorization.generator.AuthorizationGenerator in project pac4j by pac4j.

the class ClientsTests method testValuesSet.

@Test
public void testValuesSet() {
    MockIndirectClient facebookClient = newFacebookClient();
    final Clients clients = new Clients(facebookClient);
    final AjaxRequestResolver ajaxRequestResolver = new DefaultAjaxRequestResolver();
    final UrlResolver urlResolver = new DefaultUrlResolver();
    final CallbackUrlResolver callbackUrlResolver = new QueryParameterCallbackUrlResolver();
    final AuthorizationGenerator authorizationGenerator = (context, profile) -> profile;
    clients.setCallbackUrl(CALLBACK_URL);
    clients.setAjaxRequestResolver(ajaxRequestResolver);
    clients.setUrlResolver(urlResolver);
    clients.setCallbackUrlResolver(callbackUrlResolver);
    clients.addAuthorizationGenerator(authorizationGenerator);
    clients.init();
    assertEquals(CALLBACK_URL, facebookClient.getCallbackUrl());
    assertEquals(urlResolver, facebookClient.getUrlResolver());
    assertEquals(callbackUrlResolver, facebookClient.getCallbackUrlResolver());
    assertEquals(ajaxRequestResolver, facebookClient.getAjaxRequestResolver());
    assertEquals(authorizationGenerator, facebookClient.getAuthorizationGenerators().get(0));
}
Also used : TestsConstants(org.pac4j.core.util.TestsConstants) CommonProfile(org.pac4j.core.profile.CommonProfile) TestsHelper(org.pac4j.core.util.TestsHelper) Test(org.junit.Test) AjaxRequestResolver(org.pac4j.core.http.ajax.AjaxRequestResolver) DefaultAjaxRequestResolver(org.pac4j.core.http.ajax.DefaultAjaxRequestResolver) ArrayList(java.util.ArrayList) RedirectAction(org.pac4j.core.redirect.RedirectAction) List(java.util.List) UrlResolver(org.pac4j.core.http.url.UrlResolver) DefaultUrlResolver(org.pac4j.core.http.url.DefaultUrlResolver) AuthorizationGenerator(org.pac4j.core.authorization.generator.AuthorizationGenerator) QueryParameterCallbackUrlResolver(org.pac4j.core.http.callback.QueryParameterCallbackUrlResolver) Credentials(org.pac4j.core.credentials.Credentials) Assert(org.junit.Assert) CallbackUrlResolver(org.pac4j.core.http.callback.CallbackUrlResolver) UrlResolver(org.pac4j.core.http.url.UrlResolver) DefaultUrlResolver(org.pac4j.core.http.url.DefaultUrlResolver) QueryParameterCallbackUrlResolver(org.pac4j.core.http.callback.QueryParameterCallbackUrlResolver) CallbackUrlResolver(org.pac4j.core.http.callback.CallbackUrlResolver) DefaultAjaxRequestResolver(org.pac4j.core.http.ajax.DefaultAjaxRequestResolver) AjaxRequestResolver(org.pac4j.core.http.ajax.AjaxRequestResolver) DefaultAjaxRequestResolver(org.pac4j.core.http.ajax.DefaultAjaxRequestResolver) AuthorizationGenerator(org.pac4j.core.authorization.generator.AuthorizationGenerator) DefaultUrlResolver(org.pac4j.core.http.url.DefaultUrlResolver) QueryParameterCallbackUrlResolver(org.pac4j.core.http.callback.QueryParameterCallbackUrlResolver) CallbackUrlResolver(org.pac4j.core.http.callback.CallbackUrlResolver) QueryParameterCallbackUrlResolver(org.pac4j.core.http.callback.QueryParameterCallbackUrlResolver) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 Assert (org.junit.Assert)1 Test (org.junit.Test)1 AuthorizationGenerator (org.pac4j.core.authorization.generator.AuthorizationGenerator)1 Credentials (org.pac4j.core.credentials.Credentials)1 AjaxRequestResolver (org.pac4j.core.http.ajax.AjaxRequestResolver)1 DefaultAjaxRequestResolver (org.pac4j.core.http.ajax.DefaultAjaxRequestResolver)1 CallbackUrlResolver (org.pac4j.core.http.callback.CallbackUrlResolver)1 QueryParameterCallbackUrlResolver (org.pac4j.core.http.callback.QueryParameterCallbackUrlResolver)1 DefaultUrlResolver (org.pac4j.core.http.url.DefaultUrlResolver)1 UrlResolver (org.pac4j.core.http.url.UrlResolver)1 CommonProfile (org.pac4j.core.profile.CommonProfile)1 RedirectAction (org.pac4j.core.redirect.RedirectAction)1 TestsConstants (org.pac4j.core.util.TestsConstants)1 TestsHelper (org.pac4j.core.util.TestsHelper)1