本文整理汇总了Java中io.swagger.models.auth.In类的典型用法代码示例。如果您正苦于以下问题:Java In类的具体用法?Java In怎么用?Java In使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
In类属于io.swagger.models.auth包,在下文中一共展示了In类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: swaggerConfig
import io.swagger.models.auth.In; //导入依赖的package包/类
@Bean
public BeanConfig swaggerConfig() {
final BeanConfig beanConfig = new BeanConfig();
beanConfig.setResourcePackage("com.github.sbugat.samplerest.resource");
beanConfig.setVersion("1.0.0");
beanConfig.setHost("localhost:8080");
beanConfig.setBasePath(servletContext.getContextPath());
beanConfig.setTitle("Swagger CXF, JAX-RS 2.0 sample");
beanConfig.setDescription("This is a Swagger CXF, JAX-RS 2.0 sample API.");
beanConfig.setContact("Sylvain Bugat");
beanConfig.setLicense("Apache 2.0");
beanConfig.setLicenseUrl("https://github.com/Sylvain-Bugat/swagger-cxf-rest-skeleton/blob/master/LICENSE");
beanConfig.getSwagger().addSecurityDefinition("api_token", new ApiKeyAuthDefinition("api_token", In.HEADER));
beanConfig.setScan(true);
return beanConfig;
}
示例2: isValidApiKeyDefinition
import io.swagger.models.auth.In; //导入依赖的package包/类
/**
* Checks if the defined apiKey is valid or not. Only apiKey definition with name as 'key' and
* 'in' as 'query' are allowed"
*/
private boolean isValidApiKeyDefinition(ApiKeyAuthDefinition apiKeydef) {
if (apiKeydef.getName().equalsIgnoreCase("key") || apiKeydef.getIn() == In.QUERY) {
return true;
} else {
diagCollector.addDiag(
Diag.warning(
SimpleLocation.UNKNOWN,
"apiKey '%s' is ignored. Only apiKey with 'name' as 'key' and 'in' as 'query' are "
+ "supported",
apiKeydef.getName()));
return false;
}
}
示例3: apiKeyAuth
import io.swagger.models.auth.In; //导入依赖的package包/类
public static ApiKeyAuthDefinition apiKeyAuth(String name, In in) {
return new ApiKeyAuthDefinition(name, in);
}