本文整理汇总了Java中org.pac4j.core.http.HttpActionAdapter类的典型用法代码示例。如果您正苦于以下问题:Java HttpActionAdapter类的具体用法?Java HttpActionAdapter怎么用?Java HttpActionAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HttpActionAdapter类属于org.pac4j.core.http包,在下文中一共展示了HttpActionAdapter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: DefaultAsyncLogoutLogic
import org.pac4j.core.http.HttpActionAdapter; //导入依赖的package包/类
public DefaultAsyncLogoutLogic(final AsyncConfig<R, U, WC> config,
final HttpActionAdapter<R, WC> httpActionAdapter,
final String defaultUrl,
final String logoutUrlPattern,
boolean localLogout,
boolean destroySession,
boolean centralLogout) {
assertNotNull("config", config);
assertNotNull("clients", config.getClients());
assertNotNull("httpActionAdapter", httpActionAdapter);
this.logoutUrlPattern = Optional.ofNullable(logoutUrlPattern).orElse(DEFAULT_LOGOUT_URL_PATTERN_VALUE);
assertNotBlank(Pac4jConstants.LOGOUT_URL_PATTERN, this.logoutUrlPattern);
this.config = config;
this.httpActionAdapter = httpActionAdapter;
this.defaultUrl = defaultUrl;
sessionDestructionStrategy = getSessionDestructionStrategy(destroySession);
this.localLogoutStrategy = getLocalLogoutStrategy(localLogout);
this.centralLogoutStrategy = getCentralLogoutStrategy(centralLogout);
}
开发者ID:millross,项目名称:pac4j-async,代码行数:23,代码来源:DefaultAsyncLogoutLogic.java
示例2: DefaultAsyncSecurityLogic
import org.pac4j.core.http.HttpActionAdapter; //导入依赖的package包/类
public DefaultAsyncSecurityLogic(final boolean saveProfileInSession,
final boolean multiProfile,
final AsyncConfig<R, U, C> config,
final AsyncExceptionHandler<R> exceptionHandler,
final HttpActionAdapter<R, C> httpActionAdapter) {
assertNotNull("config", config);
assertNotNull("httpActionAdapter", httpActionAdapter);
this.configClients = config.getClients();
assertNotNull("configClients", config.getClients());
this.saveStrategy = multiProfile ? MULTI_PROFILE_SAVE : SINGLE_PROFILE_SAVE;
this.config = config;
this.httpActionAdapter = httpActionAdapter;
// Exception handler, to be used to deal with exceptional completion of futures
this.exceptionHandler = exceptionHandler;
directClientAuthenticator = new AsyncDirectClientAuthenticator(saveStrategy, new AsyncSaveProfileToSessionDecision<U, C>(saveProfileInSession),
this.loadFromSessionDecision);
}
开发者ID:millross,项目名称:pac4j-async,代码行数:20,代码来源:DefaultAsyncSecurityLogic.java
示例3: shouldExecuteCallback
import org.pac4j.core.http.HttpActionAdapter; //导入依赖的package包/类
@Test
public void shouldExecuteCallback() throws Exception {
String defaultUrl = "/myapp";
boolean multiProfile = true;
boolean renewSession = false;
new MockUnit(Request.class, Response.class, Config.class, WebContext.class, CallbackLogic.class,
HttpActionAdapter.class)
.expect(webContext)
.expect(callback)
.expect(actionAdapter)
.expect(execute(defaultUrl, multiProfile, renewSession))
.run(unit -> {
new Pac4jCallback(unit.get(Config.class), defaultUrl, multiProfile, renewSession)
.handle(unit.get(Request.class), unit.get(Response.class));
});
}
开发者ID:jooby-project,项目名称:jooby,代码行数:17,代码来源:Pac4jCallbackTest.java
示例4: shouldExecuteCallback
import org.pac4j.core.http.HttpActionAdapter; //导入依赖的package包/类
@Test
public void shouldExecuteCallback() throws Exception {
String defaultUrl = "/";
String logoutUrlPattern = "/.*";
boolean localLogout = true;
boolean destroySession = true;
boolean centralLogout = false;
new MockUnit(Request.class, Response.class, Config.class, WebContext.class, LogoutLogic.class,
HttpActionAdapter.class)
.expect(webContext)
.expect(getLogout)
.expect(getActionAdapter)
.expect(redirectTo(Optional.empty()))
.expect(executeCallback(defaultUrl, logoutUrlPattern, localLogout, destroySession,
centralLogout))
.run(unit -> {
Pac4jLogout action = new Pac4jLogout(unit.get(Config.class), defaultUrl, logoutUrlPattern,
localLogout, destroySession, centralLogout);
action.handle(unit.get(Request.class), unit.get(Response.class));
});
}
开发者ID:jooby-project,项目名称:jooby,代码行数:23,代码来源:Pac4jLogoutTest.java
示例5: shouldExecuteCallbackWithOptions
import org.pac4j.core.http.HttpActionAdapter; //导入依赖的package包/类
@Test
public void shouldExecuteCallbackWithOptions() throws Exception {
String defaultUrl = "/x";
String logoutUrlPattern = "/.*xx";
boolean localLogout = false;
boolean destroySession = false;
boolean centralLogout = true;
new MockUnit(Request.class, Response.class, Config.class, WebContext.class, LogoutLogic.class,
HttpActionAdapter.class)
.expect(webContext)
.expect(getLogout)
.expect(getActionAdapter)
.expect(redirectTo(Optional.empty()))
.expect(executeCallback(defaultUrl, logoutUrlPattern, localLogout, destroySession,
centralLogout))
.run(unit -> {
Pac4jLogout action = new Pac4jLogout(unit.get(Config.class), defaultUrl, logoutUrlPattern,
localLogout, destroySession, centralLogout);
action.handle(unit.get(Request.class), unit.get(Response.class));
});
}
开发者ID:jooby-project,项目名称:jooby,代码行数:23,代码来源:Pac4jLogoutTest.java
示例6: shouldRethrowTechnicalException
import org.pac4j.core.http.HttpActionAdapter; //导入依赖的package包/类
@Test(expected = TechnicalException.class)
public void shouldRethrowTechnicalException() throws Exception {
String clients = "FormClient";
String authorizers = null;
String matchers = null;
boolean multiProfile = false;
String clientParameterName = Clients.DEFAULT_CLIENT_NAME_PARAMETER;
Set<String> excludes = new HashSet<>();
TechnicalException x = new TechnicalException("intentional err");
new MockUnit(Request.class, Response.class, Config.class, WebContext.class, SecurityLogic.class,
HttpActionAdapter.class, Route.Chain.class)
.expect(webContext)
.expect(getSecurityLogic)
.expect(getActionAdapter)
.expect(clientParameterName(clientParameterName, clients, clients))
.expect(getSessionAttribute(Pac4jConstants.REQUESTED_URL, null))
.expect(executeCallback(clients, authorizers, matchers, multiProfile, x))
.run(unit -> {
Pac4jSecurityFilter action = new Pac4jSecurityFilter(unit.get(Config.class), clients,
authorizers, matchers, multiProfile, clientParameterName, excludes);
action.handle(unit.get(Request.class), unit.get(Response.class),
unit.get(Route.Chain.class));
});
}
开发者ID:jooby-project,项目名称:jooby,代码行数:26,代码来源:Pac4jSecurityFilterTest.java
示例7: shouldThrowJoobyErrWhenTechnicalExceptionWrapsIt
import org.pac4j.core.http.HttpActionAdapter; //导入依赖的package包/类
@Test(expected = Err.class)
public void shouldThrowJoobyErrWhenTechnicalExceptionWrapsIt() throws Exception {
String clients = "FormClient";
String authorizers = null;
String matchers = null;
boolean multiProfile = false;
String clientParameterName = Clients.DEFAULT_CLIENT_NAME_PARAMETER;
Set<String> excludes = new HashSet<>();
TechnicalException x = new TechnicalException(new Err(Status.UNAUTHORIZED, "intentional err"));
new MockUnit(Request.class, Response.class, Config.class, WebContext.class, SecurityLogic.class,
HttpActionAdapter.class, Route.Chain.class)
.expect(webContext)
.expect(getSecurityLogic)
.expect(getActionAdapter)
.expect(clientParameterName(clientParameterName, clients, clients))
.expect(getSessionAttribute(Pac4jConstants.REQUESTED_URL, null))
.expect(executeCallback(clients, authorizers, matchers, multiProfile, x))
.run(unit -> {
Pac4jSecurityFilter action = new Pac4jSecurityFilter(unit.get(Config.class), clients,
authorizers, matchers, multiProfile, clientParameterName, excludes);
action.handle(unit.get(Request.class), unit.get(Response.class),
unit.get(Route.Chain.class));
});
}
开发者ID:jooby-project,项目名称:jooby,代码行数:26,代码来源:Pac4jSecurityFilterTest.java
示例8: DefaultAsyncCallbackLogic
import org.pac4j.core.http.HttpActionAdapter; //导入依赖的package包/类
public DefaultAsyncCallbackLogic(final boolean multiProfile,
final boolean renewSession,
final AsyncConfig<R, U, WC> config,
final HttpActionAdapter<R, WC> httpActionAdapter) {
assertNotNull("config", config);
assertNotNull("clients", config.getClients());
assertNotNull("httpActionAdapter", httpActionAdapter);
// it doesn't make sense to mix and match single and multi profile saving for an instance of the logic
this.saveStrategy = multiProfile ? MULTI_PROFILE_SAVE : SINGLE_PROFILE_SAVE;
this.sessionRenewalStrategy = renewSession ? AsyncSessionRenewal.ALWAYS_RENEW : NEVER_RENEW;
this.config = config;
this.httpActionAdapter = httpActionAdapter;
this.indirectAuthenticationFlow = new AsyncIndirectAuthenticationFlow<>();
}
开发者ID:millross,项目名称:pac4j-async,代码行数:16,代码来源:DefaultAsyncCallbackLogic.java
示例9: perform
import org.pac4j.core.http.HttpActionAdapter; //导入依赖的package包/类
@Override
public R perform(final C context, final Config config, final HttpActionAdapter<R, C> httpActionAdapter,
final String defaultUrl, final String inputLogoutUrlPattern) {
logger.debug("=== APP LOGOUT ===");
// default value
final String logoutUrlPattern;
if (inputLogoutUrlPattern == null) {
logoutUrlPattern = Pac4jConstants.DEFAULT_LOGOUT_URL_PATTERN_VALUE;
} else {
logoutUrlPattern = inputLogoutUrlPattern;
}
// checks
assertNotNull("context", context);
assertNotNull("config", config);
assertNotNull("httpActionAdapter", httpActionAdapter);
assertNotBlank(Pac4jConstants.LOGOUT_URL_PATTERN, logoutUrlPattern);
// logic
final ProfileManager manager = getProfileManager(context);
manager.logout();
postLogout(context);
final String url = context.getRequestParameter(Pac4jConstants.URL);
String redirectUrl = defaultUrl;
if (url != null && Pattern.matches(logoutUrlPattern, url)) {
redirectUrl = url;
}
logger.debug("redirectUrl: {}", redirectUrl);
final HttpAction action;
if (redirectUrl != null) {
action = HttpAction.redirect("redirect", context, redirectUrl);
} else {
action = HttpAction.ok("ok", context);
}
return httpActionAdapter.adapt(action.getCode(), context);
}
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:41,代码来源:DefaultApplicationLogoutLogic.java
示例10: setup
import org.pac4j.core.http.HttpActionAdapter; //导入依赖的package包/类
@Override
public void setup(Bootstrap<?> bootstrap) {
ObjectMapper om = bootstrap.getObjectMapper();
// for Config
om.addMixIn(SessionStore.class, sessionStoreMixin());
om.addMixIn(Authorizer.class, authorizerMixin());
om.addMixIn(HttpActionAdapter.class, httpActionAdapterMixin());
om.addMixIn(Matcher.class, matcherMixin());
om.addMixIn(SecurityLogic.class, securityLogicMixin());
om.addMixIn(CallbackLogic.class, callbackLogicMixin());
om.addMixIn(LogoutLogic.class, logoutLogicMixin());
// for Clients
om.addMixIn(Client.class, clientMixin());
om.addMixIn(BaseClient.class, baseClientMixin());
// for Clients and Client subsclasses
om.addMixIn(AjaxRequestResolver.class, ajaxRequestResolverMixin());
om.addMixIn(UrlResolver.class, urlResolverMixin());
om.addMixIn(AuthorizationGenerator.class,
authorizationGeneratorMixin());
// for Client/BaseClient
om.addMixIn(Authenticator.class, authenticatorMixin());
om.addMixIn(CredentialsExtractor.class, credentialExtractorMixin());
om.addMixIn(ProfileCreator.class, profileCreatorMixin());
// for IndirectClient
om.addMixIn(RedirectActionBuilder.class, redirectActionBuilderMixin());
om.addMixIn(LogoutActionBuilder.class, logoutActionBuilderMixin());
// for some of the Authenticators
om.addMixIn(PasswordEncoder.class, passwordEncoderMixin());
}
开发者ID:pac4j,项目名称:dropwizard-pac4j,代码行数:36,代码来源:DefaultFeatureSupport.java
示例11: execute
import org.pac4j.core.http.HttpActionAdapter; //导入依赖的package包/类
private MockUnit.Block execute(String defaultUrl, boolean multiProfile, boolean renewSession) {
return unit -> {
CallbackLogic callback = unit.get(CallbackLogic.class);
expect(callback.perform(unit.get(WebContext.class), unit.get(Config.class),
unit.get(HttpActionAdapter.class), defaultUrl, multiProfile, renewSession))
.andReturn(null);
};
}
开发者ID:jooby-project,项目名称:jooby,代码行数:9,代码来源:Pac4jCallbackTest.java
示例12: executeCallback
import org.pac4j.core.http.HttpActionAdapter; //导入依赖的package包/类
private MockUnit.Block executeCallback(String defaultUrl, String logoutUrlPattern,
boolean localLogout, boolean destroySession, boolean centralLogout) {
return unit -> {
LogoutLogic logout = unit.get(LogoutLogic.class);
expect(logout.perform(unit.get(WebContext.class), unit.get(Config.class),
unit.get(HttpActionAdapter.class), defaultUrl, logoutUrlPattern, localLogout,
destroySession, centralLogout)).andReturn(null);
};
}
开发者ID:jooby-project,项目名称:jooby,代码行数:11,代码来源:Pac4jLogoutTest.java
示例13: shouldExecuteCallback
import org.pac4j.core.http.HttpActionAdapter; //导入依赖的package包/类
@Test
public void shouldExecuteCallback() throws Exception {
String clients = "FormClient";
String authorizers = null;
String matchers = null;
String clientParameterName = Clients.DEFAULT_CLIENT_NAME_PARAMETER;
Set<String> excludes = Sets.newHashSet("/profile");
boolean multiProfile = false;
new MockUnit(Request.class, Response.class, Config.class, WebContext.class, SecurityLogic.class,
HttpActionAdapter.class, Route.Chain.class)
.expect(webContext)
.expect(getSecurityLogic)
.expect(getActionAdapter)
.expect(clientParameterName(clientParameterName, clients, clients))
.expect(getSessionAttribute(Pac4jConstants.REQUESTED_URL, null))
.expect(requestMatches("/profile", false))
.expect(executeCallback(clients, authorizers, matchers, multiProfile))
.run(unit -> {
Pac4jSecurityFilter action = new Pac4jSecurityFilter(unit.get(Config.class), clients,
authorizers, matchers, multiProfile, clientParameterName, excludes);
assertEquals("FormClient", action.toString());
action.handle(unit.get(Request.class), unit.get(Response.class),
unit.get(Route.Chain.class));
});
}
开发者ID:jooby-project,项目名称:jooby,代码行数:28,代码来源:Pac4jSecurityFilterTest.java
示例14: shouldResetRequestedUrl
import org.pac4j.core.http.HttpActionAdapter; //导入依赖的package包/类
@Test
public void shouldResetRequestedUrl() throws Exception {
String clients = "FormClient";
String authorizers = null;
String matchers = null;
String clientParameterName = Clients.DEFAULT_CLIENT_NAME_PARAMETER;
Set<String> excludes = ImmutableSet.of("/**", "/facebook");
boolean multiProfile = false;
new MockUnit(Request.class, Response.class, Config.class, WebContext.class, SecurityLogic.class,
HttpActionAdapter.class, Route.Chain.class, Session.class)
.expect(webContext)
.expect(getSecurityLogic)
.expect(getActionAdapter)
.expect(clientParameterName(clientParameterName, clients, clients))
.expect(getSessionAttribute(Pac4jConstants.REQUESTED_URL, "/previous"))
.expect(requestMatches("/facebook", true))
.expect(executeCallback(clients, authorizers, matchers, multiProfile))
.expect(ifSession(true))
.expect(setSessionAttribute(Pac4jConstants.REQUESTED_URL, "/previous"))
.run(unit -> {
Pac4jSecurityFilter action = new Pac4jSecurityFilter(unit.get(Config.class), clients,
authorizers, matchers, multiProfile, clientParameterName, excludes);
assertEquals("FormClient", action.toString());
action.handle(unit.get(Request.class), unit.get(Response.class),
unit.get(Route.Chain.class));
});
}
开发者ID:jooby-project,项目名称:jooby,代码行数:30,代码来源:Pac4jSecurityFilterTest.java
示例15: shouldIgnoreResetRequestedUrlIfNoSession
import org.pac4j.core.http.HttpActionAdapter; //导入依赖的package包/类
@Test
public void shouldIgnoreResetRequestedUrlIfNoSession() throws Exception {
String clients = "FormClient";
String authorizers = null;
String matchers = null;
String clientParameterName = Clients.DEFAULT_CLIENT_NAME_PARAMETER;
Set<String> excludes = ImmutableSet.of("/**", "/facebook");
boolean multiProfile = false;
new MockUnit(Request.class, Response.class, Config.class, WebContext.class, SecurityLogic.class,
HttpActionAdapter.class, Route.Chain.class, Session.class)
.expect(webContext)
.expect(getSecurityLogic)
.expect(getActionAdapter)
.expect(clientParameterName(clientParameterName, clients, clients))
.expect(getSessionAttribute(Pac4jConstants.REQUESTED_URL, "/previous"))
.expect(requestMatches("/facebook", true))
.expect(executeCallback(clients, authorizers, matchers, multiProfile))
.expect(ifSession(false))
.run(unit -> {
Pac4jSecurityFilter action = new Pac4jSecurityFilter(unit.get(Config.class), clients,
authorizers, matchers, multiProfile, clientParameterName, excludes);
assertEquals("FormClient", action.toString());
action.handle(unit.get(Request.class), unit.get(Response.class),
unit.get(Route.Chain.class));
});
}
开发者ID:jooby-project,项目名称:jooby,代码行数:29,代码来源:Pac4jSecurityFilterTest.java
示例16: shouldExecuteCallbackWithClients
import org.pac4j.core.http.HttpActionAdapter; //导入依赖的package包/类
@Test
public void shouldExecuteCallbackWithClients() throws Exception {
String clients = "FormClient";
String authorizers = null;
String matchers = null;
boolean multiProfile = false;
String clientParameterName = Clients.DEFAULT_CLIENT_NAME_PARAMETER;
Set<String> excludes = new HashSet<>();
new MockUnit(Request.class, Response.class, Config.class, WebContext.class, SecurityLogic.class,
HttpActionAdapter.class, Route.Chain.class)
.expect(webContext)
.expect(getSecurityLogic)
.expect(getActionAdapter)
.expect(clientParameterName(clientParameterName, clients + ",FacebookClient",
clients + ",FacebookClient"))
.expect(getSessionAttribute(Pac4jConstants.REQUESTED_URL, null))
.expect(executeCallback(clients + ",FacebookClient", authorizers, matchers, multiProfile))
.run(unit -> {
Pac4jSecurityFilter action = new Pac4jSecurityFilter(unit.get(Config.class), clients,
authorizers, matchers, multiProfile, clientParameterName, excludes)
.addClient("FacebookClient");
assertEquals("FormClient,FacebookClient", action.toString());
action.handle(unit.get(Request.class), unit.get(Response.class),
unit.get(Route.Chain.class));
});
}
开发者ID:jooby-project,项目名称:jooby,代码行数:29,代码来源:Pac4jSecurityFilterTest.java
示例17: executeCallback
import org.pac4j.core.http.HttpActionAdapter; //导入依赖的package包/类
private MockUnit.Block executeCallback(String defaultUrl, String logoutUrlPattern,
String matchers, boolean multiProfile, Throwable x) {
return unit -> {
SecurityLogic action = unit.get(SecurityLogic.class);
IExpectationSetters<Object> expect = expect(
action.perform(eq(unit.get(WebContext.class)), eq(unit.get(Config.class)),
isA(Pac4jGrantAccessAdapter.class), eq(unit.get(HttpActionAdapter.class)),
eq(defaultUrl), eq(logoutUrlPattern), eq(matchers), eq(multiProfile)));
if (x == null)
expect.andReturn(null);
else
expect.andThrow(x);
};
}
开发者ID:jooby-project,项目名称:jooby,代码行数:16,代码来源:Pac4jSecurityFilterTest.java
示例18: getHttpActionAdapter
import org.pac4j.core.http.HttpActionAdapter; //导入依赖的package包/类
public HttpActionAdapter getHttpActionAdapter() {
return httpActionAdapter;
}
开发者ID:millross,项目名称:pac4j-async,代码行数:4,代码来源:Config.java
示例19: setHttpActionAdapter
import org.pac4j.core.http.HttpActionAdapter; //导入依赖的package包/类
public void setHttpActionAdapter(final HttpActionAdapter httpActionAdapter) {
this.httpActionAdapter = httpActionAdapter;
}
开发者ID:millross,项目名称:pac4j-async,代码行数:4,代码来源:Config.java
示例20: perform
import org.pac4j.core.http.HttpActionAdapter; //导入依赖的package包/类
@Override
public R perform(final C context, final Config config, final HttpActionAdapter<R, C> httpActionAdapter,
final String inputDefaultUrl, final Boolean inputMultiProfile, final Boolean inputRenewSession) {
logger.debug("=== CALLBACK ===");
// default values
final String defaultUrl;
if (inputDefaultUrl == null) {
defaultUrl = Pac4jConstants.DEFAULT_URL_VALUE;
} else {
defaultUrl = inputDefaultUrl;
}
final boolean multiProfile;
if (inputMultiProfile == null) {
multiProfile = false;
} else {
multiProfile = inputMultiProfile;
}
final boolean renewSession;
if (inputRenewSession == null) {
renewSession = true;
} else {
renewSession = inputRenewSession;
}
// checks
assertNotNull("context", context);
assertNotNull("config", config);
assertNotNull("httpActionAdapter", httpActionAdapter);
assertNotBlank(Pac4jConstants.DEFAULT_URL, defaultUrl);
final Clients clients = config.getClients();
assertNotNull("clients", clients);
// logic
final Client client = clients.findClient(context);
logger.debug("client: {}", client);
assertNotNull("client", client);
assertTrue(client instanceof IndirectClient, "only indirect clients are allowed on the callback url");
HttpAction action;
try {
final Credentials credentials = client.getCredentials(context);
logger.debug("credentials: {}", credentials);
final CommonProfile profile = client.getUserProfile(credentials, context);
logger.debug("profile: {}", profile);
saveUserProfile(context, profile, multiProfile, renewSession);
action = redirectToOriginallyRequestedUrl(context, defaultUrl);
} catch (final HttpAction e) {
logger.debug("extra HTTP action required in callback: {}", e.getCode());
action = e;
}
return httpActionAdapter.adapt(action.getCode(), context);
}
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:58,代码来源:DefaultCallbackLogic.java
注:本文中的org.pac4j.core.http.HttpActionAdapter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论