简体   繁体   English

如何从身份验证中排除某些 Vaadin 视图?

[英]How do I exclude certain Vaadin views from authentication?

I want to make a couple of Vaadin (v22) views accessible without a login, ie make them publicly available.我想让几个 Vaadin (v22) 视图无需登录即可访问,即公开它们。 I looked at this tutorial, which is probably outdated: https://vaadin.com/learn/tutorials/securing-your-app-with-spring-security There it says, that all views not using the @Secured annotation are publicly accessible.我看了这个教程,它可能已经过时了: https://vaadin.com/learn/tutorials/securing-your-app-with-spring-security它说,所有不使用@Secured注释的视图都是公开访问的. In my case it is different.在我的情况下是不同的。 Nothing is accessible at all, unless anotated with @PermitAll then logged in users can access the page.根本无法访问任何内容,除非使用@PermitAll进行注释,然后登录用户才能访问该页面。

As ever so often, I found the answer while preparing the question.一如既往,我在准备问题时找到了答案。

The annotation to use is @AnonymousAllowed要使用的注解是@AnonymousAllowed

Example:例子:

@Route(value = "/welcome", layout = PublicLayout.class)
@RouteAlias(value = "", layout = PublicLayout.class)
@AnonymousAllowed
public class PublicWelcomePage extends Div {
   // create your view here 
}

Official Vaadin v22 docs 官方 Vaadin v22 文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM