springfox.documentation.service.SecurityReference Java Examples
The following examples show how to use
springfox.documentation.service.SecurityReference.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Swagger2.java From gpmall with Apache License 2.0 | 7 votes |
List<SecurityReference> defaultAuth() { AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; return new ArrayList() {{ add(new SecurityReference("Authorization", authorizationScopes)); }}; }
Example #2
Source File: Application.java From springfox-demos with Apache License 2.0 | 6 votes |
@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(); List<SecurityContext> securityContexts = Collections.singletonList( SecurityContext.builder() .securityReferences(Collections.singletonList(securityReference)) .build()); return new Docket(DocumentationType.SWAGGER_2) .securitySchemes(Collections.singletonList(new BasicAuth("test"))) .securityContexts(securityContexts) .groupName("user-api") .apiInfo(apiInfo()) .select() .paths(input -> input.contains("user")) .build(); }
Example #3
Source File: SwaggerConfig.java From angularjs-springmvc-sample-boot with Apache License 2.0 | 6 votes |
@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(); }
Example #4
Source File: Swagger2Config.java From mall with Apache License 2.0 | 5 votes |
private List<SecurityReference> defaultAuth() { List<SecurityReference> result = new ArrayList<>(); AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; result.add(new SecurityReference("Authorization", authorizationScopes)); return result; }
Example #5
Source File: Swagger2Config.java From mall-learning with Apache License 2.0 | 5 votes |
private List<SecurityReference> defaultAuth() { List<SecurityReference> result = new ArrayList<>(); AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; result.add(new SecurityReference("Authorization", authorizationScopes)); return result; }
Example #6
Source File: Swagger2Config.java From mall-learning with Apache License 2.0 | 5 votes |
private List<SecurityReference> defaultAuth() { List<SecurityReference> result = new ArrayList<>(); AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; result.add(new SecurityReference("Authorization", authorizationScopes)); return result; }
Example #7
Source File: Swagger2Config.java From mall-learning with Apache License 2.0 | 5 votes |
private List<SecurityReference> defaultAuth() { List<SecurityReference> result = new ArrayList<>(); AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; result.add(new SecurityReference("Authorization", authorizationScopes)); return result; }
Example #8
Source File: Swagger2Config.java From mall-learning with Apache License 2.0 | 5 votes |
private List<SecurityReference> defaultAuth() { List<SecurityReference> result = new ArrayList<>(); AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; result.add(new SecurityReference("Authorization", authorizationScopes)); return result; }
Example #9
Source File: Swagger2Config.java From mall-learning with Apache License 2.0 | 5 votes |
private List<SecurityReference> defaultAuth() { List<SecurityReference> result = new ArrayList<>(); AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; result.add(new SecurityReference("Authorization", authorizationScopes)); return result; }
Example #10
Source File: Swagger2Config.java From mall-learning with Apache License 2.0 | 5 votes |
private List<SecurityReference> defaultAuth() { List<SecurityReference> result = new ArrayList<>(); AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; result.add(new SecurityReference("Authorization", authorizationScopes)); return result; }
Example #11
Source File: Swagger2Config.java From mall-swarm with Apache License 2.0 | 5 votes |
private List<SecurityReference> defaultAuth() { List<SecurityReference> result = new ArrayList<>(); AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; result.add(new SecurityReference("Authorization", authorizationScopes)); return result; }
Example #12
Source File: Swagger2Config.java From mall-swarm with Apache License 2.0 | 5 votes |
private List<SecurityReference> defaultAuth() { List<SecurityReference> result = new ArrayList<>(); AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; result.add(new SecurityReference("Authorization", authorizationScopes)); return result; }
Example #13
Source File: Swagger2Config.java From mall-swarm with Apache License 2.0 | 5 votes |
private List<SecurityReference> defaultAuth() { List<SecurityReference> result = new ArrayList<>(); AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; result.add(new SecurityReference("Authorization", authorizationScopes)); return result; }
Example #14
Source File: Swagger2Config.java From macrozheng with Apache License 2.0 | 5 votes |
private List<SecurityReference> defaultAuth() { List<SecurityReference> result = new ArrayList<>(); AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; result.add(new SecurityReference("Authorization", authorizationScopes)); return result; }
Example #15
Source File: SwaggerConfig.java From pacbot with Apache License 2.0 | 5 votes |
@Bean SecurityContext securityContext() { AuthorizationScope readScope = new AuthorizationScope(scope, scopeDesc); AuthorizationScope[] scopes = new AuthorizationScope[1]; scopes[0] = readScope; SecurityReference securityReference = SecurityReference.builder().reference(state).scopes(scopes) .build(); return SecurityContext.builder().securityReferences(newArrayList(securityReference)).forPaths(PathSelectors.any()) .build(); }
Example #16
Source File: Swagger2Config.java From mall-learning with Apache License 2.0 | 5 votes |
private List<SecurityReference> defaultAuth() { List<SecurityReference> result = new ArrayList<>(); AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; result.add(new SecurityReference("Authorization", authorizationScopes)); return result; }
Example #17
Source File: Swagger2Config.java From mall with Apache License 2.0 | 5 votes |
private List<SecurityReference> defaultAuth() { List<SecurityReference> result = new ArrayList<>(); AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; result.add(new SecurityReference("Authorization", authorizationScopes)); return result; }
Example #18
Source File: SwaggerAutoConfiguration.java From Taroco with Apache License 2.0 | 5 votes |
private List<SecurityReference> defaultAuth() { AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; List<SecurityReference> references = new ArrayList<>(1); references.add(new SecurityReference("Authorization", authorizationScopes)); return references; }
Example #19
Source File: SwaggerConfig.java From DimpleBlog with Apache License 2.0 | 5 votes |
private List<SecurityReference> defaultAuth() { AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; List<SecurityReference> securityReferences = new ArrayList<>(); securityReferences.add(new SecurityReference("Authorization", authorizationScopes)); return securityReferences; }
Example #20
Source File: SwaggerConfig.java From BlogManagePlatform with Apache License 2.0 | 5 votes |
/** * 默认验证配置 * @author Frodez * @date 2019-01-06 */ private List<SecurityReference> defaultAuth() { AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; return List.of(new SecurityReference(security.getJwt().getTokenPrefix(), authorizationScopes)); }
Example #21
Source File: MainController.java From steady with Apache License 2.0 | 5 votes |
/** * <p>userApi.</p> * * @return a {@link springfox.documentation.spring.web.plugins.Docket} object. */ @Bean public Docket userApi() { AuthorizationScope[] authScopes = new AuthorizationScope[1]; authScopes[0] = new AuthorizationScopeBuilder() .scope("read") .description("read access") .build(); SecurityReference securityReference1 = SecurityReference.builder() .reference("tenant") .scopes(authScopes) .build(); SecurityReference securityReference2 = SecurityReference.builder() .reference("space") .scopes(authScopes) .build(); ArrayList<SecurityContext> securityContexts = newArrayList(SecurityContext.builder().securityReferences (newArrayList(securityReference1, securityReference2)).build()); return new Docket(DocumentationType.SWAGGER_2) .groupName("user-api") .apiInfo(this.getApiInfo()) .select() //.apis(RequestHandlerSelectors.any()) .paths(this.userPaths()) .build() //.pathMapping("/") .securitySchemes(newArrayList(this.tenantKey(), this.spaceKey())) .securityContexts(securityContexts) ; }
Example #22
Source File: MainController.java From steady with Apache License 2.0 | 5 votes |
/** * <p>adminApi.</p> * * @return a {@link springfox.documentation.spring.web.plugins.Docket} object. */ @Bean public Docket adminApi() { 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) .apiInfo(this.getApiInfo()) .groupName("config-api") .select() //.apis(RequestHandlerSelectors.any()) .paths(this.configPaths()) .build() //.pathMapping("/") .securitySchemes(newArrayList(new BasicAuth("test"))) .securityContexts(securityContexts) ; /*.directModelSubstitute(LocalDate.class, String.class).genericModelSubstitutes(ResponseEntity.class) .alternateTypeRules(newRule(typeResolver.resolve(DeferredResult.class, typeResolver.resolve(ResponseEntity.class, WildcardType.class)), typeResolver.resolve(WildcardType.class))) .useDefaultResponseMessages(false) .globalResponseMessage(RequestMethod.GET, newArrayList(new ResponseMessageBuilder().code(500).message("500 message").responseModel(new ModelRef("Error")).build())) .securitySchemes(newArrayList(this.tenantKey())).securityContexts(newArrayList(securityContext()));*/ }
Example #23
Source File: OAuthServerConfiguration.java From microservices-basics-spring-boot with Apache License 2.0 | 5 votes |
List<SecurityReference> defaultAuth() { AuthorizationScope authorizationScope = new AuthorizationScope(OAUTH2_CLIENT_SCOPE, "Access for open id default"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; return Lists.newArrayList(new SecurityReference(AUTHORIZATION_HEADER, authorizationScopes)); }
Example #24
Source File: SwaggerConfiguration.java From iotplatform with Apache License 2.0 | 5 votes |
List<SecurityReference> defaultAuth() { AuthorizationScope[] authorizationScopes = new AuthorizationScope[3]; authorizationScopes[0] = new AuthorizationScope(Authority.SYS_ADMIN.name(), "System administrator"); authorizationScopes[1] = new AuthorizationScope(Authority.TENANT_ADMIN.name(), "Tenant administrator"); authorizationScopes[2] = new AuthorizationScope(Authority.CUSTOMER_USER.name(), "Customer"); return newArrayList( new SecurityReference("X-Authorization", authorizationScopes)); }
Example #25
Source File: SwaggerConfig.java From spring-security-oauth with MIT License | 5 votes |
private SecurityContext securityContext() { return SecurityContext.builder() .securityReferences( Arrays.asList(new SecurityReference("spring_oauth", scopes()))) .forPaths(PathSelectors.regex("/foos.*")) .build(); }
Example #26
Source File: Application.java From springfox-demos with Apache License 2.0 | 5 votes |
@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(Collections.singletonList(securityReference)) .forPaths(ant("/api/pet.*")) .build(); }
Example #27
Source File: Swagger2Config.java From HIS with Apache License 2.0 | 5 votes |
private List<SecurityReference> defaultAuth() { List<SecurityReference> result = new ArrayList<>(); AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; result.add(new SecurityReference("Authorization", authorizationScopes)); return result; }
Example #28
Source File: Swagger2Config.java From BigDataPlatform with GNU General Public License v3.0 | 5 votes |
private List<SecurityReference> defaultAuth() { List<SecurityReference> result = new ArrayList<>(); AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; result.add(new SecurityReference("Authorization", authorizationScopes)); return result; }
Example #29
Source File: Swagger2.java From stone with GNU General Public License v3.0 | 5 votes |
List<SecurityReference> defaultAuth() { AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; return newArrayList( new SecurityReference("token", authorizationScopes)); }
Example #30
Source File: SwaggerAutoConfiguration.java From microservices-platform with Apache License 2.0 | 5 votes |
private List<SecurityReference> defaultAuth() { AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; List<SecurityReference> references = new ArrayList<>(1); references.add(new SecurityReference(AUTH_KEY, authorizationScopes)); return references; }