本文整理汇总了Java中springfox.documentation.spi.service.contexts.SecurityContext类的典型用法代码示例。如果您正苦于以下问题:Java SecurityContext类的具体用法?Java SecurityContext怎么用?Java SecurityContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SecurityContext类属于springfox.documentation.spi.service.contexts包,在下文中一共展示了SecurityContext类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: userApi
import springfox.documentation.spi.service.contexts.SecurityContext; //导入依赖的package包/类
@Bean
public Docket userApi() {
AuthorizationScope[] authScopes = new AuthorizationScope[1];
authScopes[0] = new AuthorizationScopeBuilder()
.scope("read")
.description("read access")
.build();
SecurityReference securityReference = SecurityReference.builder()
.reference("test")
.scopes(authScopes)
.build();
ArrayList<SecurityContext> securityContexts = Lists.newArrayList(
SecurityContext.builder()
.securityReferences(Lists.newArrayList(securityReference))
.build()
);
return new Docket(DocumentationType.SWAGGER_2)
.directModelSubstitute(LocalDateTime.class, String.class)
.ignoredParameterTypes(User.class)
.securitySchemes(Lists.newArrayList(new BasicAuth("test")))
.securityContexts(securityContexts)
.apiInfo(apiInfo())
.select()
.paths(apiPaths())
.build();
}
示例2: userApi
import springfox.documentation.spi.service.contexts.SecurityContext; //导入依赖的package包/类
@Bean
public Docket userApi() {
AuthorizationScope[] authScopes = new AuthorizationScope[1];
authScopes[0] = new AuthorizationScopeBuilder()
.scope("read")
.description("read access")
.build();
SecurityReference securityReference = SecurityReference.builder()
.reference("test")
.scopes(authScopes)
.build();
ArrayList<SecurityContext> securityContexts = newArrayList(SecurityContext.builder().securityReferences
(newArrayList(securityReference)).build());
return new Docket(DocumentationType.SWAGGER_2)
.securitySchemes(newArrayList(new BasicAuth("test")))
.securityContexts(securityContexts)
.groupName("user-api")
.apiInfo(apiInfo())
.select()
.paths(userOnlyEndpoints())
.build();
}
示例3: securityContext
import springfox.documentation.spi.service.contexts.SecurityContext; //导入依赖的package包/类
private List<SecurityContext> securityContext() {
SecurityContext context = SecurityContext.builder()
.securityReferences(defaultAuth())
.forPaths(securePaths())
.build();
return Collections.singletonList(context);
}
示例4: securityContext
import springfox.documentation.spi.service.contexts.SecurityContext; //导入依赖的package包/类
@Bean
SecurityContext securityContext() {
AuthorizationScope readScope = new AuthorizationScope("read:pets", "read your pets");
AuthorizationScope[] scopes = new AuthorizationScope[1];
scopes[0] = readScope;
SecurityReference securityReference = SecurityReference.builder()
.reference("petstore_auth")
.scopes(scopes)
.build();
return SecurityContext.builder()
.securityReferences(newArrayList(securityReference))
.forPaths(ant("/api/pet.*"))
.build();
}
示例5: securityContext
import springfox.documentation.spi.service.contexts.SecurityContext; //导入依赖的package包/类
private SecurityContext securityContext() {
SecurityContextBuilder builder = SecurityContext.builder();
if (swaggerOauth2SupportEnabled){
List<SecurityReference> defaultOAuthSecurityReference = Arrays.asList(new SecurityReference(SECURITY_SCHEMA_OAUTH2, getOauth2Scopes()));
if (defaultOAuthSecurityReference != null){
builder.securityReferences(defaultOAuthSecurityReference);
}
}
return builder.forPaths(defaultGroup()).build();
}
示例6: securityContext
import springfox.documentation.spi.service.contexts.SecurityContext; //导入依赖的package包/类
private SecurityContext securityContext() {
return SecurityContext.builder()
.securityReferences(defaultAuth())
.forPaths(input -> input != null && (input.contains("/organisations/") || input.contains("/users")))
.build();
}
示例7: publicContext
import springfox.documentation.spi.service.contexts.SecurityContext; //导入依赖的package包/类
private SecurityContext publicContext() {
return SecurityContext.builder()
.forPaths(PathSelectors.regex("/auth(/.*)?"))
.build();
}
示例8: defaultContext
import springfox.documentation.spi.service.contexts.SecurityContext; //导入依赖的package包/类
private SecurityContext defaultContext() {
return SecurityContext.builder()
.forPaths(PathSelectors.any())
.securityReferences(defaultAuth())
.build();
}
示例9: securityContext
import springfox.documentation.spi.service.contexts.SecurityContext; //导入依赖的package包/类
private SecurityContext securityContext() {
return SecurityContext.builder().securityReferences(defaultAuth()).forPaths(PathSelectors.regex("/api/*")).build();
}
示例10: securityContext
import springfox.documentation.spi.service.contexts.SecurityContext; //导入依赖的package包/类
private SecurityContext securityContext() {
return SecurityContext.builder()
.securityReferences(defaultAuth())
.forPaths(regex())
.build();
}
示例11: securityContext
import springfox.documentation.spi.service.contexts.SecurityContext; //导入依赖的package包/类
private SecurityContext securityContext() {
return SecurityContext.builder()
.securityReferences(defaultAuth())
.forPaths(securityPaths())
.build();
}
示例12: securityContext
import springfox.documentation.spi.service.contexts.SecurityContext; //导入依赖的package包/类
private SecurityContext securityContext() {
return SecurityContext.builder()
.securityReferences(defaultAuth())
.forPaths(PathSelectors.regex("/anyPath.*"))
.build();
}
示例13: securityContext
import springfox.documentation.spi.service.contexts.SecurityContext; //导入依赖的package包/类
private SecurityContext securityContext() {
return SecurityContext.builder()
.securityReferences(defaultAuth())
.forPaths(PathSelectors.regex("/anyPath.*"))
.build();
}
示例14: securityContext
import springfox.documentation.spi.service.contexts.SecurityContext; //导入依赖的package包/类
private SecurityContext securityContext() {
return SecurityContext.builder()
.securityReferences(defaultAuth())
.forPaths(PathSelectors.regex("/anyPath.*"))
.build();
}