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


Java VaadinRequest.getUserPrincipal方法代码示例

本文整理汇总了Java中com.vaadin.server.VaadinRequest.getUserPrincipal方法的典型用法代码示例。如果您正苦于以下问题:Java VaadinRequest.getUserPrincipal方法的具体用法?Java VaadinRequest.getUserPrincipal怎么用?Java VaadinRequest.getUserPrincipal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vaadin.server.VaadinRequest的用法示例。


在下文中一共展示了VaadinRequest.getUserPrincipal方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onAppStarted

import com.vaadin.server.VaadinRequest; //导入方法依赖的package包/类
@Order(Events.HIGHEST_PLATFORM_PRECEDENCE + 10)
@EventListener
protected void onAppStarted(AppStartedEvent event) throws LoginException {
    Connection connection = event.getApp().getConnection();
    // can be already authenticated by another event listener
    if (webIdpConfig.getIdpEnabled()
            && !connection.isAuthenticated()) {
        VaadinRequest currentRequest = VaadinService.getCurrentRequest();

        if (currentRequest != null) {
            Principal principal = currentRequest.getUserPrincipal();

            if (principal instanceof IdpSessionPrincipal) {
                IdpSession idpSession = ((IdpSessionPrincipal) principal).getIdpSession();

                Locale locale = event.getApp().getLocale();

                ExternalUserCredentials credentials = new ExternalUserCredentials(principal.getName(), locale);
                credentials.setSessionAttributes(
                        ImmutableMap.of(
                                IdpService.IDP_USER_SESSION_ATTRIBUTE,
                                idpSession.getId()
                        ));

                connection.login(credentials);
            }
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:30,代码来源:IdpLoginLifecycleManager.java

示例2: userSessionLoggedIn

import com.vaadin.server.VaadinRequest; //导入方法依赖的package包/类
@Override
public void userSessionLoggedIn(UserSession session) {
    VaadinRequest currentRequest = VaadinService.getCurrentRequest();

    if (currentRequest != null) {
        Principal principal = currentRequest.getUserPrincipal();

        if (principal instanceof IdpSessionPrincipal) {
            IdpSession idpSession = ((IdpSessionPrincipal) principal).getIdpSession();
            session.setAttribute(IdpService.IDP_USER_SESSION_ATTRIBUTE, idpSession.getId());
        }
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:14,代码来源:IdpAuthProvider.java

示例3: getUIClass

import com.vaadin.server.VaadinRequest; //导入方法依赖的package包/类
@Override
public Class<? extends UI> getUIClass(UIClassSelectionEvent event) {

	VaadinRequest request = event.getRequest();

	String url = parseUIMapping(request);
	// If url is login, return LoginUI class
	if (url.contains("login")) {
		return LoginUI.class;
	}

	// If url is an empty url then return Secure if user is an
	// authenticated else return login UI
	if (url.isEmpty()) {
		Principal principal = request.getUserPrincipal();
		if (null == principal) {

			return LoginUI.class;
		}
		return SecureUI.class;
	}
	// Return the secured UI
	if (url.contains("secured")) {
		return SecureUI.class;
	}

	return null;
}
 
开发者ID:KrishnaPhani,项目名称:KrishnasSpace,代码行数:29,代码来源:CustomVaadinServlet.java

示例4: isUserAuthenticated

import com.vaadin.server.VaadinRequest; //导入方法依赖的package包/类
private boolean isUserAuthenticated(final VaadinRequest vaadinRequest) {
    return vaadinRequest.getUserPrincipal() != null;
}
 
开发者ID:mrts,项目名称:vaadin-javaee-jaas-example,代码行数:4,代码来源:JaasExampleUI.java

示例5: isUserAuthenticated

import com.vaadin.server.VaadinRequest; //导入方法依赖的package包/类
private boolean isUserAuthenticated(VaadinRequest vaadinRequest) {
    return vaadinRequest.getUserPrincipal() != null;
}
 
开发者ID:mrts,项目名称:vaadin-javaee-clinic-patient-queue-example,代码行数:4,代码来源:DoctorsOfficeUI.java


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