本文整理汇总了Java中springfox.documentation.service.AuthorizationScope类的典型用法代码示例。如果您正苦于以下问题:Java AuthorizationScope类的具体用法?Java AuthorizationScope怎么用?Java AuthorizationScope使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AuthorizationScope类属于springfox.documentation.service包,在下文中一共展示了AuthorizationScope类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: userApi
import springfox.documentation.service.AuthorizationScope; //导入依赖的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: defaultAuth
import springfox.documentation.service.AuthorizationScope; //导入依赖的package包/类
List<SecurityReference> defaultAuth() {
AuthorizationScope authorizationScope
= new AuthorizationScope("global", "accessEverything");
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
authorizationScopes[0] = authorizationScope;
return newArrayList(
new SecurityReference("mykey", authorizationScopes));
}
示例3: defaultAuth
import springfox.documentation.service.AuthorizationScope; //导入依赖的package包/类
List<SecurityReference> defaultAuth() {
AuthorizationScope authorizationScope
= new AuthorizationScope("global", "accessEverything");
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
authorizationScopes[0] = authorizationScope;
return newArrayList(
new SecurityReference("mykey", authorizationScopes));
}
示例4: userApi
import springfox.documentation.service.AuthorizationScope; //导入依赖的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();
}
示例5: defaultAuth
import springfox.documentation.service.AuthorizationScope; //导入依赖的package包/类
private List<SecurityReference> defaultAuth() {
AuthorizationScope[] authorizationScopes = new AuthorizationScope[]{
new AuthorizationScope("read", "read only"),
new AuthorizationScope("write", "read and write")
};
return Collections.singletonList(new SecurityReference("Authorization", authorizationScopes));
}
示例6: oAuth
import springfox.documentation.service.AuthorizationScope; //导入依赖的package包/类
private List<SecurityScheme> oAuth() {
// browser
List<AuthorizationScope> scopes1 = new ArrayList<AuthorizationScope>();
scopes1.add(new AuthorizationScope("ui", "browser"));
List<GrantType> gTypes1 = new ArrayList<GrantType>();
//gTypes1.add(new GrantType("refresh_token"));
gTypes1.add(new ResourceOwnerPasswordCredentialsGrant(oauthServerUri));
OAuth oAuth1 = new OAuth("browser", scopes1, gTypes1);
// Server
List<AuthorizationScope> scopes2 = new ArrayList<AuthorizationScope>();
scopes2.add(new AuthorizationScope("server", "server"));
List<GrantType> gTypes2 = new ArrayList<GrantType>();
gTypes2.add(new ClientCredentialsGrant(oauthServerUri));
//gTypes2.add(new GrantType("refresh_token"));
OAuth oAuth2 = new OAuth("account-service", scopes2, gTypes2);
List<SecurityScheme> list = new ArrayList<SecurityScheme>();
list.add(oAuth1);
list.add(oAuth2);
return list;
}
示例7: scopes
import springfox.documentation.service.AuthorizationScope; //导入依赖的package包/类
private List<AuthorizationScope> scopes() {
List<AuthorizationScope> list = new ArrayList();
list.add(new AuthorizationScope("read_scope","Grants read access"));
list.add(new AuthorizationScope("write_scope","Grants write access"));
list.add(new AuthorizationScope("admin_scope","Grants read write and delete access"));
return list;
}
示例8: defaultAuth
import springfox.documentation.service.AuthorizationScope; //导入依赖的package包/类
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));
}
示例9: securityContext
import springfox.documentation.service.AuthorizationScope; //导入依赖的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();
}
示例10: defaultAuth
import springfox.documentation.service.AuthorizationScope; //导入依赖的package包/类
List<SecurityReference> defaultAuth() {
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
authorizationScopes[0] = authorizationScope;
return asList(
new SecurityReference("mykey", authorizationScopes));
}
示例11: defaultAuth
import springfox.documentation.service.AuthorizationScope; //导入依赖的package包/类
List<SecurityReference> defaultAuth() {
AuthorizationScope authorizationScope
= new AuthorizationScope("global", "accessEverything");
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
authorizationScopes[0] = authorizationScope;
return Lists.newArrayList(
new SecurityReference("mykey", authorizationScopes));
}
示例12: defaultAuth
import springfox.documentation.service.AuthorizationScope; //导入依赖的package包/类
private List<SecurityReference> defaultAuth() {
return singletonList(SecurityReference.builder()
.scopes(new AuthorizationScope[0])
.reference(BASIC_AUTH)
.build());
}
示例13: defaultAuth
import springfox.documentation.service.AuthorizationScope; //导入依赖的package包/类
List<SecurityReference> defaultAuth() {
final AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
final AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
authorizationScopes[0] = authorizationScope;
return newArrayList(new SecurityReference("mykey", authorizationScopes));
}
示例14: scopes
import springfox.documentation.service.AuthorizationScope; //导入依赖的package包/类
List<AuthorizationScope> scopes() {
return newArrayList(
new AuthorizationScope("write:pets", "modify pets in your account"),
new AuthorizationScope("read:pets", "read your pets"));
}