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


Java SecurityContext类代码示例

本文整理汇总了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();
}
 
开发者ID:hantsy,项目名称:angularjs-springmvc-sample-boot,代码行数:27,代码来源:SwaggerConfig.java

示例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();
}
 
开发者ID:springfox,项目名称:springfox-demos,代码行数:24,代码来源:Application.java

示例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);
}
 
开发者ID:BakkerTom,项目名称:happy-news,代码行数:9,代码来源:SwaggerConfig.java

示例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();
}
 
开发者ID:springfox,项目名称:springfox-demos,代码行数:16,代码来源:Application.java

示例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();
}
 
开发者ID:Appverse,项目名称:appverse-server,代码行数:11,代码来源:SwaggerDefaultSetup.java

示例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();
}
 
开发者ID:MannanM,项目名称:corporate-game-share,代码行数:7,代码来源:SwaggerConfiguration.java

示例7: publicContext

import springfox.documentation.spi.service.contexts.SecurityContext; //导入依赖的package包/类
private SecurityContext publicContext() {
    return SecurityContext.builder()
            .forPaths(PathSelectors.regex("/auth(/.*)?"))
            .build();
}
 
开发者ID:redlink-gmbh,项目名称:smarti,代码行数:6,代码来源:SwaggerConfiguration.java

示例8: defaultContext

import springfox.documentation.spi.service.contexts.SecurityContext; //导入依赖的package包/类
private SecurityContext defaultContext() {
    return SecurityContext.builder()
            .forPaths(PathSelectors.any())
            .securityReferences(defaultAuth())
            .build();
}
 
开发者ID:redlink-gmbh,项目名称:smarti,代码行数:7,代码来源:SwaggerConfiguration.java

示例9: securityContext

import springfox.documentation.spi.service.contexts.SecurityContext; //导入依赖的package包/类
private SecurityContext securityContext() {
    return SecurityContext.builder().securityReferences(defaultAuth()).forPaths(PathSelectors.regex("/api/*")).build();
}
 
开发者ID:tvajjala,项目名称:interview-preparation,代码行数:4,代码来源:ApiDocumentationConfig.java

示例10: securityContext

import springfox.documentation.spi.service.contexts.SecurityContext; //导入依赖的package包/类
private SecurityContext securityContext() {
    return SecurityContext.builder()
            .securityReferences(defaultAuth())
            .forPaths(regex())
            .build();
}
 
开发者ID:KonkerLabs,项目名称:konker-platform,代码行数:7,代码来源:SwaggerUIConfig.java

示例11: securityContext

import springfox.documentation.spi.service.contexts.SecurityContext; //导入依赖的package包/类
private SecurityContext securityContext() {
      return SecurityContext.builder()
              .securityReferences(defaultAuth())
              .forPaths(securityPaths())
              .build();
}
 
开发者ID:thingsboard,项目名称:thingsboard,代码行数:7,代码来源:SwaggerConfiguration.java

示例12: securityContext

import springfox.documentation.spi.service.contexts.SecurityContext; //导入依赖的package包/类
private SecurityContext securityContext() {
  return SecurityContext.builder()
      .securityReferences(defaultAuth())
      .forPaths(PathSelectors.regex("/anyPath.*"))
      .build();
}
 
开发者ID:candrews,项目名称:availability,代码行数:7,代码来源:SwaggerConfig.java

示例13: securityContext

import springfox.documentation.spi.service.contexts.SecurityContext; //导入依赖的package包/类
private SecurityContext securityContext() {
    return SecurityContext.builder()
            .securityReferences(defaultAuth())
            .forPaths(PathSelectors.regex("/anyPath.*"))
            .build();
}
 
开发者ID:saitejatokala,项目名称:SpringBoot-Swagger2,代码行数:7,代码来源:Application.java

示例14: securityContext

import springfox.documentation.spi.service.contexts.SecurityContext; //导入依赖的package包/类
private SecurityContext securityContext() {
    return SecurityContext.builder()
        .securityReferences(defaultAuth())
        .forPaths(PathSelectors.regex("/anyPath.*"))
        .build();
}
 
开发者ID:moss0801,项目名称:apidoc,代码行数:7,代码来源:ServletConfig.java


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