springfox.documentation.service.SecurityScheme Java Examples
The following examples show how to use
springfox.documentation.service.SecurityScheme.
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: Swagger2Config.java From sophia_scaffolding with Apache License 2.0 | 6 votes |
/** * 创建RestApi 并包扫描controller * @return */ @Bean public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) //分组名称 // .groupName("2.X版本") .select() // // 对所有api进行监控 // .apis(RequestHandlerSelectors.any()) .apis(RequestHandlerSelectors.basePackage(basePackage)) //不显示错误的接口地址 .paths(PathSelectors.any()) //错误路径不监控 .paths(Predicates.not(PathSelectors.regex("/error.*"))) // .build(); .build() .securityContexts(Lists.newArrayList(securityContext())).securitySchemes(Lists.<SecurityScheme>newArrayList(apiKey())); }
Example #2
Source File: Swagger2Config.java From sophia_scaffolding with Apache License 2.0 | 6 votes |
/** * 创建RestApi 并包扫描controller * @return */ @Bean public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) //分组名称 // .groupName("2.X版本") .select() // // 对所有api进行监控 // .apis(RequestHandlerSelectors.any()) .apis(RequestHandlerSelectors.basePackage(basePackage)) //不显示错误的接口地址 .paths(PathSelectors.any()) //错误路径不监控 .paths(Predicates.not(PathSelectors.regex("/error.*"))) // .build(); .build() .securityContexts(Lists.newArrayList(securityContext())).securitySchemes(Lists.<SecurityScheme>newArrayList(apiKey())); }
Example #3
Source File: SwaggerConfig.java From pacbot with Apache License 2.0 | 5 votes |
private List<? extends SecurityScheme> chooseSecuritSchema() { if (dataSource.equalsIgnoreCase("db") || dataSource.equalsIgnoreCase("ldap")) { return newArrayList(new BasicAuth(BASIC_AUTH)); } else if (dataSource.equalsIgnoreCase("azuread")) { return newArrayList(oauth()); } return newArrayList(apiKey()); }
Example #4
Source File: SwaggerConfig.java From springfox-oath2-demo with Apache License 2.0 | 5 votes |
@Bean SecurityScheme oauth() { return new OAuthBuilder() .name("OAuth2") .scopes(scopes()) .grantTypes(grantTypes()) .build(); }
Example #5
Source File: SwaggerConfig.java From spring-security-oauth with MIT License | 5 votes |
private SecurityScheme securityScheme() { GrantType grantType = new AuthorizationCodeGrantBuilder() .tokenEndpoint(new TokenEndpoint(AUTH_SERVER + "/token", "oauthtoken")) .tokenRequestEndpoint( new TokenRequestEndpoint(AUTH_SERVER + "/authorize", CLIENT_ID, CLIENT_ID)) .build(); SecurityScheme oauth = new OAuthBuilder().name("spring_oauth") .grantTypes(Arrays.asList(grantType)) .scopes(Arrays.asList(scopes())) .build(); return oauth; }
Example #6
Source File: Application.java From springfox-demos with Apache License 2.0 | 5 votes |
@Bean SecurityScheme oauth() { return new OAuthBuilder() .name("petstore_auth") .grantTypes(grantTypes()) .scopes(scopes()) .build(); }
Example #7
Source File: SwaggerConfig.java From pacbot with Apache License 2.0 | 4 votes |
@Bean SecurityScheme oauth() { return new OAuthBuilder().name(state).grantTypes(grantTypes()).scopes(scopes()).build(); }
Example #8
Source File: MainController.java From steady with Apache License 2.0 | 4 votes |
@Bean SecurityScheme tenantKey() { return new ApiKey("tenant", Constants.HTTP_TENANT_HEADER, "header"); }
Example #9
Source File: MainController.java From steady with Apache License 2.0 | 4 votes |
@Bean SecurityScheme spaceKey() { return new ApiKey("space", Constants.HTTP_SPACE_HEADER, "header"); }
Example #10
Source File: SwaggerAutoConfiguration.java From mcloud with Apache License 2.0 | 4 votes |
private List<SecurityScheme> apiKeys() { ArrayList<SecurityScheme> securitySchemes = new ArrayList<>(); securitySchemes.add(new ApiKey("Authorization", "Authorization", "header")); return securitySchemes; }
Example #11
Source File: Application.java From springfox-demos with Apache License 2.0 | 4 votes |
@Bean SecurityScheme apiKey() { return new ApiKey("api_key", "api_key", "header"); }
Example #12
Source File: Swagger2Config.java From jeecg-cloud with Apache License 2.0 | 2 votes |
/*** * oauth2配置 * 需要增加swagger授权回调地址 * http://localhost:8888/webjars/springfox-swagger-ui/o2c.html * @return */ @Bean SecurityScheme securityScheme() { return new ApiKey(CommonConstant.X_ACCESS_TOKEN, CommonConstant.X_ACCESS_TOKEN, "header"); }
Example #13
Source File: Swagger2Config.java From jeecg-boot-with-activiti with MIT License | 2 votes |
/*** * oauth2配置 * 需要增加swagger授权回调地址 * http://localhost:8888/webjars/springfox-swagger-ui/o2c.html * @return */ @Bean SecurityScheme securityScheme() { return new ApiKey(DefContants.X_ACCESS_TOKEN, DefContants.X_ACCESS_TOKEN, "header"); }
Example #14
Source File: Swagger2Config.java From teaching with Apache License 2.0 | 2 votes |
/*** * oauth2配置 * 需要增加swagger授权回调地址 * http://localhost:8888/webjars/springfox-swagger-ui/o2c.html * @return */ @Bean SecurityScheme securityScheme() { return new ApiKey(DefContants.X_ACCESS_TOKEN, DefContants.X_ACCESS_TOKEN, "header"); }
Example #15
Source File: Swagger2Config.java From jeecg-boot with Apache License 2.0 | 2 votes |
/*** * oauth2配置 * 需要增加swagger授权回调地址 * http://localhost:8888/webjars/springfox-swagger-ui/o2c.html * @return */ @Bean SecurityScheme securityScheme() { return new ApiKey(DefContants.X_ACCESS_TOKEN, DefContants.X_ACCESS_TOKEN, "header"); }