当前位置: 首页>>代码示例>>Java>>正文


Java AuthenticatedWebSession类代码示例

本文整理汇总了Java中org.apache.wicket.authroles.authentication.AuthenticatedWebSession的典型用法代码示例。如果您正苦于以下问题:Java AuthenticatedWebSession类的具体用法?Java AuthenticatedWebSession怎么用?Java AuthenticatedWebSession使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AuthenticatedWebSession类属于org.apache.wicket.authroles.authentication包,在下文中一共展示了AuthenticatedWebSession类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: LoginForm

import org.apache.wicket.authroles.authentication.AuthenticatedWebSession; //导入依赖的package包/类
public LoginForm(String markupId) {
    super(markupId);
    this.setDefaultModel(new CompoundPropertyModel<Object>(this));

    this.add(new TextField("username").setRequired(true));
    this.add(new PasswordTextField("password").setRequired(true));

    Button submitBtn = new AjaxButton("loginBtn", Model.of("Sign In")) {
        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            if (AuthenticatedWebSession.get().signIn(username, password))
                setResponsePage(DiscoverItemsPage.class);
            else {
                target.add(ComponentUtils.displayBlock(alert));
            }
        }
    };
    this.add(submitBtn);
    this.setDefaultButton(submitBtn);
}
 
开发者ID:citlab,项目名称:Intercloud,代码行数:21,代码来源:LoginPanel.java

示例2: onSubmit

import org.apache.wicket.authroles.authentication.AuthenticatedWebSession; //导入依赖的package包/类
@Override
protected void onSubmit()
{
    AuthenticatedWebSession session = AuthenticatedWebSession.get();
    if (session.signIn(username, password)) {
        log.debug("Login successful");
        if (sessionRegistry != null) {
            // Form-based login isn't detected by SessionManagementFilter. Thus handling
            // session registration manually here.
            HttpSession containerSession = ((ServletWebRequest) RequestCycle.get()
                    .getRequest()).getContainerRequest().getSession(false);
            sessionRegistry.registerNewSession(containerSession.getId(), username);
        }
        setDefaultResponsePageIfNecessary();
    }
    else {
        error("Login failed");
    }
}
 
开发者ID:webanno,项目名称:webanno,代码行数:20,代码来源:LoginPage.java

示例3: route

import org.apache.wicket.authroles.authentication.AuthenticatedWebSession; //导入依赖的package包/类
@Override
public Object route(final Object original) {

    if(original != null) {
        return original;
    }

    // ensure that any persisted objects have been deleted.
    container.flush();

    final BreadcrumbModelProvider  wicketSession = (BreadcrumbModelProvider) AuthenticatedWebSession.get();
    final BreadcrumbModel breadcrumbModel = wicketSession.getBreadcrumbModel();

    final List<EntityModel> breadcrumbs = breadcrumbModel.getList();
    final Optional<Object> firstViewModelOrNonDeletedPojoIfAny = breadcrumbs.stream()
            .filter(entityModel -> entityModel != null).map(EntityModel::getObject)
            .filter(objectAdapter -> objectAdapter != null).map(ObjectAdapter::getObject)
            .filter(pojo -> !(pojo instanceof Persistable) || !((Persistable)pojo).dnIsDeleted())
            .findFirst();
    return firstViewModelOrNonDeletedPojoIfAny.orElse(homePage());
}
 
开发者ID:isisaddons,项目名称:isis-app-todoapp,代码行数:22,代码来源:RoutingServiceUsingBreadcrumbs.java

示例4: LogoutPage

import org.apache.wicket.authroles.authentication.AuthenticatedWebSession; //导入依赖的package包/类
protected LogoutPage(IPageLinkDescriptor signInPageLinkDescriptor) {
	if(AuthenticatedWebSession.exists()) {
		AuthenticatedWebSession.get().invalidate();
	}
	
	throw signInPageLinkDescriptor.newRestartResponseException();
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:8,代码来源:LogoutPage.java

示例5: commonInit

import org.apache.wicket.authroles.authentication.AuthenticatedWebSession; //导入依赖的package包/类
@SuppressWarnings("serial")
private void commonInit()
{
    add(new Label("username").setDefaultModel(new Model<>(SecurityContextHolder
            .getContext().getAuthentication().getName())));

    add(new StatelessLink<Void>("logout")
    {
        @Override
        public void onClick()
        {
            AuthenticatedWebSession.get().signOut();
            getSession().invalidate();
            setResponsePage(getApplication().getHomePage());
        }
    });
    
    add(new MarkupContainer("logoutTimer")
    {
        @Override
        protected void onConfigure()
        {
            super.onConfigure();
            setVisible(getAutoLogoutTime() > 0);
        }
    });
}
 
开发者ID:webanno,项目名称:webanno,代码行数:28,代码来源:LogoutPanel.java

示例6: onSubmit

import org.apache.wicket.authroles.authentication.AuthenticatedWebSession; //导入依赖的package包/类
@Override
protected void onSubmit() {
	AuthenticatedWebSession session = AuthenticatedWebSession.get();
	if (session.signIn(username, password)) {
		setResponsePage(HomePage.class);
	} else {
		error("Login failed");
	}
}
 
开发者ID:MarcGiffing,项目名称:wicket-spring-boot,代码行数:10,代码来源:LoginPage.java

示例7: onSubmit

import org.apache.wicket.authroles.authentication.AuthenticatedWebSession; //导入依赖的package包/类
@Override
public void onSubmit() {
    LoginInfo loginInfo = (LoginInfo) form.getDefaultModelObject();
    String username = loginInfo.getUsername();
    String password = loginInfo.getPassword();
    boolean signedIn = AuthenticatedWebSession.get().signIn(username, password);

    HttpServletRequest httpServletRequest = WicketUtils.getHttpServletRequest();
    if (signedIn) {
        /**
         * If login has been called because the user was not yet logged in, than continue to the original
         * destination otherwise to the Home page
         */
        try {
            if (!continueToOriginalDestination()) {
                setResponsePage(ArtifactoryApplication.get().getHomePage());
            }
        } catch (RuntimeException ignored) {
            setResponsePage(ArtifactoryApplication.get().getHomePage());
        }
        //set a remember me cookie for the first success login
        if (!ConstantValues.securityDisableRememberMe.getBoolean()) {
            try {
                rememberMeServices.loginSuccess(httpServletRequest, WicketUtils.getHttpServletResponse(),
                        AuthenticationHelper.getAuthentication());
            } catch (UsernameNotFoundException e) {
                log.warn("Remember Me service is not supported for transient external users.");
            }
        }
    } else {
        if (!ConstantValues.securityDisableRememberMe.getBoolean()) {
            //Try the component based localizer first. If not found try the application localizer. Else use the default
            error("Username or password are incorrect. Login failed.");
            rememberMeServices.loginFail(httpServletRequest, getHttpServletResponse());
        }
    }
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:38,代码来源:DefaultLoginLink.java

示例8: getHomePage

import org.apache.wicket.authroles.authentication.AuthenticatedWebSession; //导入依赖的package包/类
@Override
public Class<? extends Page> getHomePage() {
    return AuthenticatedWebSession.get().isSignedIn()
            && SyncopeConsoleSession.get().owns(StandardEntitlement.MUST_CHANGE_PASSWORD)
            ? MustChangePassword.class
            : Dashboard.class;
}
 
开发者ID:apache,项目名称:syncope,代码行数:8,代码来源:SyncopeConsoleApplication.java

示例9: RegisterPage

import org.apache.wicket.authroles.authentication.AuthenticatedWebSession; //导入依赖的package包/类
public RegisterPage(PageParameters parameters) {
	super(parameters);
	
	if (AuthenticatedWebSession.exists() && AuthenticatedWebSession.get().isSignedIn()) {
		redirect(DashboardPage.class);
		return;
	}
	
	HttpServletRequest request = ((ServletWebRequest) RequestCycle.get().getRequest()).getContainerRequest();
	ClientAuthenticationToken token = (ClientAuthenticationToken) request.getSession().getAttribute(Pac4jAuthenticationUtils.AUTH_TOKEN_ATTRIBUTE);
	
	IModel<User> userModel = new GenericEntityModel<Long, User>(new User());
	
	if (token != null && token.getUserProfile() != null) {
		CommonProfile profile = (CommonProfile) token.getUserProfile();
		if (profile.getEmail() != null) {
			User user = userService.getByUserName(profile.getEmail());
			if (user != null) {
				LOGGER.warn("This email address is already used by another user");
				getSession().warn(getString("register.userName.notUnique"));
			}
		}
		
		userModel.getObject().setEmail(profile.getEmail());
		userModel.getObject().setFullName(profile.getDisplayName());
		userModel.getObject().setRemoteIdentifier(profile.getId());
	}

	addBreadCrumbElement(new BreadCrumbElement(new ResourceModel("register.pageTitle"), RegisterPage.linkDescriptor()));
	
	add(new Label("pageTitle", new ResourceModel("register.pageTitle")));
	
	add(new RegisterFormPanel("registerFormPanel", userModel));
}
 
开发者ID:openwide-java,项目名称:artifact-listener,代码行数:35,代码来源:RegisterPage.java

示例10: getWebSessionClass

import org.apache.wicket.authroles.authentication.AuthenticatedWebSession; //导入依赖的package包/类
@Override
protected Class<? extends AuthenticatedWebSession> getWebSessionClass() {
	return BasicApplicationSession.class;
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:5,代码来源:BasicApplicationApplication.java

示例11: getWebSessionClass

import org.apache.wicket.authroles.authentication.AuthenticatedWebSession; //导入依赖的package包/类
@Override
protected Class<? extends AuthenticatedWebSession> getWebSessionClass() {
	return ShowcaseSession.class;
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:5,代码来源:ShowcaseApplication.java

示例12: CoreWicketAuthenticatedApplication

import org.apache.wicket.authroles.authentication.AuthenticatedWebSession; //导入依赖的package包/类
public CoreWicketAuthenticatedApplication() {
	super();
	
	// Get web session class to instantiate
	webSessionClassRef = new WeakReference<Class<? extends AuthenticatedWebSession>>(getWebSessionClass());
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:7,代码来源:CoreWicketAuthenticatedApplication.java

示例13: hasAnyRole

import org.apache.wicket.authroles.authentication.AuthenticatedWebSession; //导入依赖的package包/类
@Override
public final boolean hasAnyRole(final Roles roles) {
	final Roles sessionRoles = AuthenticatedWebSession.get().getRoles();
	return sessionRoles != null && sessionRoles.hasAnyRole(roles);
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:6,代码来源:CoreWicketAuthenticatedApplication.java

示例14: onConfigure

import org.apache.wicket.authroles.authentication.AuthenticatedWebSession; //导入依赖的package包/类
@Override
protected void onConfigure()
{
    super.onConfigure();
    setVisible(AuthenticatedWebSession.get().isSignedIn());
}
 
开发者ID:webanno,项目名称:webanno,代码行数:7,代码来源:LogoutPanel.java

示例15: get

import org.apache.wicket.authroles.authentication.AuthenticatedWebSession; //导入依赖的package包/类
public static EtcdWebSession get() {
    return (EtcdWebSession)AuthenticatedWebSession.get();
}
 
开发者ID:nikfoundas,项目名称:etcd-viewer,代码行数:4,代码来源:EtcdWebSession.java


注:本文中的org.apache.wicket.authroles.authentication.AuthenticatedWebSession类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。