分类

链接

2023 年 2 月
 12345
6789101112
13141516171819
20212223242526
2728  

近期文章

热门标签

新人福利,免费薅羊毛

swagger隐藏authentication参数

@Bean public Docket oauthApi() {     return new Docket(DocumentationType.SWAGGER_2)         .groupName("oauth")         .apiInfo(metaData())         .ignoredParameterTypes(Authentication.class)         .select()         .apis(RequestHandlerSelectors.any())         .paths(PathSelectors.ant("/oauth/**"))         .build()         .securitySchemes(Collections.singletonList(securitySchema()))         .securityContexts(Collections.singletonList(securityContext())); }

JAVA 暂无评论 阅读(69)

Spring Security 中的自定义PreAuthorize 注解

controller: @NeedAdmin @GetMapping(path ="user", produces ="application/json") publicResponseEntity<User> getUser(@RequestParamString login){ ... } 自定义注解anno: @PreAuthorize("hasAuthority('Admin')") @Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface  NeedAdmin { }

JAVA 暂无评论 阅读(98)