當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。