本文整理汇总了Java中org.apache.wicket.RestartResponseAtInterceptPageException类的典型用法代码示例。如果您正苦于以下问题:Java RestartResponseAtInterceptPageException类的具体用法?Java RestartResponseAtInterceptPageException怎么用?Java RestartResponseAtInterceptPageException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RestartResponseAtInterceptPageException类属于org.apache.wicket包,在下文中一共展示了RestartResponseAtInterceptPageException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SummonerQueryForwardPage
import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
public SummonerQueryForwardPage(PageParameters parameters) {
super(parameters, "Summoner Search", null);
// get summoner name and region sent by the form
String summonerName = parameters.get("summonerName").toString("");
String regionName = parameters.get("region").toString("").toUpperCase();
// insert data to error page
add(new Label("summoner_name", summonerName));
add(new Label("region", regionName));
// check if summoner name and region are valid, if not return to show error page
if (summonerName == null || summonerName.length() == 0) return;
if (!EnumUtils.isValidEnum(RiotEndpoint.class, regionName)) return;
// convert region name to RiotEndpoint object
RiotEndpoint region = RiotEndpoint.valueOf(regionName);
// generate the summoners statistic
Pair<String, SummonerStatisticItem> summonerStatistic = PageDataProvider.generateSummonerStatistic(summonerName, region);
// if statistic generation failed, return to show error page
if (summonerStatistic == null) return;
// forward to single summoner page with region and summoner key name
throw new RestartResponseAtInterceptPageException(SingleSummonerPage.class, new PageParameters()
.set(0, regionName).set(1, summonerStatistic.getKey()));
}
示例2: handleCallback
import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
@Override
protected void handleCallback(PageParameters parameters, SessionClientInfo sessionClientInfo) throws Exception
{
super.handleCallback(parameters, sessionClientInfo);
try
{
CrestClientInfo clientInfo = (CrestClientInfo) sessionClientInfo.getOauthClientInfo();
getVerifyData(clientInfo);
CoreController.getController().fireAuthenticatedEvent(clientInfo, AuthEventListener.Type.Authenticated);
} catch (Exception e)
{
LoggerFactory.getLogger(getClass()).info("OAuth authentication phase 2 failed", e);
throw new RestartResponseAtInterceptPageException(SignOutPage.class);
}
throw new RestartResponseAtInterceptPageException(LoginPage.class);
}
示例3: isInstantiationAuthorized
import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
@Override
public <T extends IRequestableComponent> boolean isInstantiationAuthorized(Class<T> componentClass) {
// if it's not a wicket page --> allow
if (!Page.class.isAssignableFrom(componentClass)) {
return true;
}
// if it's a page that does not require authentication --> allow
for (Class<? extends WebPage> clazz : PAGES_WO_AUTH_REQ) {
if (clazz.isAssignableFrom(componentClass)) {
return true;
}
}
// if it's any other wicket page and user is not logged in -->
// redirect to login page
if (!((UQSession) Session.get()).isAuthenticated()) {
throw new RestartResponseAtInterceptPageException(LoginPage.class);
}
return true;
}
示例4: newPage
import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
@Override
public <C extends IRequestablePage> C newPage(final Class<C> pageClass) {
LOG.debug("Creating new {} page without parameters", pageClass.getName());
if (!Application.get().getSecuritySettings().getAuthorizationStrategy().isInstantiationAuthorized(pageClass)) {
throw new RestartResponseAtInterceptPageException(wicketSettings.getLoginPageClass());
}
try {
final C pageInstance = injector.createChildInjector(new AbstractModule() {
@Override
protected void configure() {
bind(PageParameters.class).toInstance(new PageParameters());
}
}).getInstance(pageClass);
return pageInstance;
} catch(final ConfigurationException e) {
LOG.debug("Could not create page {} through Guice, trying manually: {}", pageClass, e.getMessage());
return createOrThrow(pageClass, null);
}
}
示例5: isInstantiationAuthorized
import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
@Override
public <T extends IRequestableComponent> boolean isInstantiationAuthorized(
Class<T> componentClass) {
if(!Page.class.isAssignableFrom(componentClass)){
return true;
}
if(RegisterPage.class.isAssignableFrom(componentClass)){
return true;
}
if(LogoutPage.class.isAssignableFrom(componentClass)){
return true;
}
if(LoginPage.class.isAssignableFrom(componentClass)){
return true;
}
@SuppressWarnings("rawtypes")
UserSession session = (UserSession)Session.get();
if(session.getUser().isAnonymous){
throw new RestartResponseAtInterceptPageException(LoginPage.class);
}
return true;
}
示例6: setAuthorizationStrategy
import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
/**
* Initializes the authorization strategy for the web application. Pages,
* which implement the {@link AuthenticatedWebPage} interface, are only
* accessible for authenticated users.
*/
private void setAuthorizationStrategy() {
this.getSecuritySettings().setAuthorizationStrategy(new IAuthorizationStrategy() {
@Override
public boolean isActionAuthorized(final Component component, final Action action) {
// authorize everything
return true;
}
@Override
public <T extends IRequestableComponent> boolean isInstantiationAuthorized(final Class<T> componentClass) {
// Check if the new Page requires authentication
// (implements the marker interface)
if (AuthenticatedWebPage.class.isAssignableFrom(componentClass)) {
// Is user signed in?
if (((AuthenticatedSession) Session.get()).isSignedIn()) {
// okay to proceed
return true;
}
// Intercept the request, but remember the target
// for later.
// Invoke Component.continueToOriginalDestination()
// after successful logon to
// continue with the target remembered.
throw new RestartResponseAtInterceptPageException(LoginPage.class);
}
// okay to proceed
return true;
}
});
}
示例7: newRestartResponseAtInterceptPageException
import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
@Override
public RestartResponseAtInterceptPageException newRestartResponseAtInterceptPageException() throws LinkParameterValidationRuntimeException {
Class<? extends Page> pageClass = getValidPageClass();
PageParameters parameters = getValidatedParameters();
return new RestartResponseAtInterceptPageException(pageClass, parameters);
}
示例8: onUnauthorizedInstantiation
import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
@Override
public void onUnauthorizedInstantiation(final Component component) {
SyncopeSession.get().invalidate();
if (component instanceof Page) {
throw new UnauthorizedInstantiationException(component.getClass());
}
throw new RestartResponseAtInterceptPageException(Login.class);
}
示例9: isInstantiationAuthorized
import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
@Override
public <T extends IRequestableComponent> boolean isInstantiationAuthorized(Class<T> componentClass) {
if (!hasSpringSecuredAnnotation(componentClass)) {
return true;
}
boolean authorized = isAuthorized(componentClass);
if (Page.class.isAssignableFrom(componentClass) && !authorized) {
String missingPermissions = ArrayUtils.toString(componentClass.getAnnotation(Secured.class).value());
Session.get().error("Zugriff verweigert fehlende Berechtigung(en): " + missingPermissions);
throw new RestartResponseAtInterceptPageException(LoginPage.class);
}
return authorized;
}
示例10: onUnauthorizedInstantiation
import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
@Override
public void onUnauthorizedInstantiation(final Component component)
{
if (MySession.get().isMobileUserAgent() == true) {
throw new RestartResponseAtInterceptPageException(LoginMobilePage.class);
} else {
throw new RestartResponseAtInterceptPageException(LoginPage.class);
}
}
示例11: addSecurityAuthorization
import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
protected void addSecurityAuthorization() {
Class<? extends Page> signInPageClass = LoginPage.class;
if (CasUtil.isCasUsed()) {
signInPageClass = CasLoginPage.class;
}
IAuthorizationStrategy authStrategy = new SimplePageAuthorizationStrategy(SecurePage.class, signInPageClass) {
@Override
protected boolean isAuthorized() {
boolean b = NextServerSession.get().isSignedIn();
if (!b) {
if (CasUtil.isCasUsed()) {
LOG.debug("Checking if context contains CAS authentication");
b = NextServerSession.get().checkForSignIn();
if (!b) {
String serviceUrl = CasUtil.getServiceProperties().getService();
String loginUrl = CasUtil.getLoginUrl();
LOG.debug("cas authentication: service URL: " + serviceUrl);
String redirectUrl = loginUrl + "?service=" + serviceUrl;
LOG.debug("attempting to redirect to: " + redirectUrl);
throw new RestartResponseAtInterceptPageException(new RedirectPage(redirectUrl));
}
}
}
return b;
}
};
getSecuritySettings().setAuthorizationStrategy(authStrategy);
}
示例12: checkReady
import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
private void checkReady() {
if (!GitPlex.getInstance().isReady() && getClass() != ServerInitPage.class)
throw new RestartResponseAtInterceptPageException(ServerInitPage.class);
}
示例13: unauthorized
import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
public void unauthorized() {
if (getLoginUser() != null)
throw new UnauthorizedException("You are not allowed to perform this operation");
else
throw new RestartResponseAtInterceptPageException(LoginPage.class);
}
示例14: onInitialize
import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
@Override
protected void onInitialize() {
super.onInitialize();
this.originalUrl = RestartResponseAtInterceptPageException.getOriginalUrl();
this.form = new Form<>("form");
this.add(this.form);
this.loginField = new TextField<>("loginField", new PropertyModel<>(this, "login"));
this.loginField.setRequired(true);
this.form.add(this.loginField);
this.loginFeedback = new TextFeedbackPanel("loginFeedback", this.loginField);
this.form.add(this.loginFeedback);
this.passwordField = new PasswordTextField("passwordField", new PropertyModel<>(this, "password"));
this.passwordField.setRequired(true);
this.form.add(this.passwordField);
this.passwordFeedback = new TextFeedbackPanel("passwordFeedback", this.passwordField);
this.form.add(this.passwordFeedback);
this.language = "Khmer";
this.languageField = new DropDownChoice<String>("languageField", new PropertyModel<>(this, "language"), new PropertyModel<>(this, "languages")) {
@Override
protected boolean wantOnSelectionChangedNotifications() {
return true;
}
@Override
protected void onSelectionChanged(String newSelection) {
if (StringUtils.equalsIgnoreCase("Khmer", newSelection)) {
this.getSession().setLocale(new Locale("km"));
} else {
this.getSession().setLocale(new Locale("en"));
}
}
};
this.languageField.setRequired(true);
this.form.add(this.languageField);
this.languageFeedback = new TextFeedbackPanel("languageFeedback", this.languageField);
this.form.add(this.languageFeedback);
this.loginButton = new Button("loginButton");
this.loginButton.setOnSubmit(this::loginButtonOnSubmit);
this.form.add(this.loginButton);
if (AbstractAuthenticatedWebSession.get().isSignedIn()) {
setResponsePage(getApplication().getHomePage());
}
}
示例15: newRestartResponseAtInterceptPageException
import org.apache.wicket.RestartResponseAtInterceptPageException; //导入依赖的package包/类
@Override
public RestartResponseAtInterceptPageException newRestartResponseAtInterceptPageException()
throws LinkInvalidTargetRuntimeException, LinkParameterValidationRuntimeException,
LinkParameterInjectionRuntimeException {
throw invalidException();
}