/** * 配置默认的全局鉴权策略;其中返回的 SecurityReference 中,reference 即为ApiKey对象里面的name,保持一致才能开启全局鉴权 * * @return */ private List<SecurityReference> defaultAuth() { AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; return Collections.singletonList(SecurityReference.builder() .reference(swaggerProperties().getAuthorization().getName()) .scopes(authorizationScopes).build()); }
private AuthorizationScope globalScope() { return new AuthorizationScope("global", "accessEverything"); }
List<AuthorizationScope> scopes() { return newArrayList( new AuthorizationScope("write:pets", "modify pets in your account"), new AuthorizationScope("read:pets", "read your pets")); }
List<SecurityReference> defaultAuth() { AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; return Arrays.asList(); // return Arrays.asList( // new SecurityReference(AdminInterceptor.AUTH_HEADER, authorizationScopes), // new SecurityReference(CompanyUserInterceptor.AUTH_HEADER, authorizationScopes)); }
List<SecurityReference> defaultAuth() { AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; return Arrays.asList(); // return Arrays.asList( // new SecurityReference(AdminInterceptor.AUTH_HEADER, authorizationScopes), // new SecurityReference(CompanyUserInterceptor.AUTH_HEADER, authorizationScopes)); }
List<AuthorizationScope> scopes() { List<AuthorizationScope> scopes = Lists.<AuthorizationScope>newArrayList(); scopes.add(new AuthorizationScope(scope, scopeDesc)); return scopes; }
private List<AuthorizationScope> scopes() { List<AuthorizationScope> scopes = new ArrayList<>(); scopes.add(new AuthorizationScope("read","Read access on the API")); scopes.add(new AuthorizationScope("write","Write access on the API")); return scopes; }
private List<AuthorizationScope> scopes() { return singletonList(new AuthorizationScope("read", "Access read API")); }
private List<SecurityReference> defaultAuth() { AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessNothing"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; return Lists.newArrayList(new SecurityReference("authorization", authorizationScopes)); } }
List<SecurityReference> defaultAuth() { AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; return Lists.newArrayList( new SecurityReference("mykey", authorizationScopes)); }
List<SecurityReference> defaultAuth() { AuthorizationScope authorizationScope = new AuthorizationScope("all", "all"); return singletonList(new SecurityReference(BASIC_AUTH, new AuthorizationScope[] { authorizationScope })); } }
private SecurityReference securityReference() { final AuthorizationScope authorizationScope = new AuthorizationScope("global", "Access REST APIs"); return new SecurityReference(API_KEY_NAME, new AuthorizationScope[] {authorizationScope}); } }
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; }
List<SecurityReference> defaultAuth() { AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; return newArrayList(new SecurityReference("mykey", authorizationScopes)); }
List<SecurityReference> defaultAuth() { AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; return new ArrayList(Collections.singleton(new SecurityReference("Authorization", authorizationScopes))); }
private SecurityScheme apiImplicitScheme() { final List<AuthorizationScope> authorizationScopes = Arrays.stream(Scope.values()) .map(s -> new AuthorizationScope(s.toString(), s.toString())) .collect(Collectors.toList()); final LoginEndpoint loginEndpoint = new LoginEndpoint("/oauth/authorize"); final GrantType grantType = new ImplicitGrant(loginEndpoint, "access_token"); return new OAuth(API_REFERENCE, authorizationScopes, Lists.newArrayList(grantType)); }
private List<SecurityReference> defaultAuth() { AuthorizationScope globalScope = new AuthorizationScope("global", "Access everything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = globalScope; return singletonList(SecurityReference.builder() .reference(ENTANDO_AUTH) .scopes(authorizationScopes) .build()); }
@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(); }
/** * 默认的全局鉴权策略 * * @return */ private List<SecurityReference> defaultAuth() { ArrayList<AuthorizationScope> authorizationScopeList = new ArrayList<>(); swaggerProperties().getAuthorization().getAuthorizationScopeList().forEach(authorizationScope -> authorizationScopeList.add(new AuthorizationScope(authorizationScope.getScope(), authorizationScope.getDescription()))); AuthorizationScope[] authorizationScopes = new AuthorizationScope[authorizationScopeList.size()]; return Collections.singletonList(SecurityReference.builder() .reference(swaggerProperties().getAuthorization().getName()) .scopes(authorizationScopeList.toArray(authorizationScopes)) .build()); }
private OAuth securitySchema() { ArrayList<AuthorizationScope> authorizationScopeList = new ArrayList<>(); swaggerProperties().getAuthorization().getAuthorizationScopeList().forEach(authorizationScope -> authorizationScopeList.add(new AuthorizationScope(authorizationScope.getScope(), authorizationScope.getDescription()))); ArrayList<GrantType> grantTypes = new ArrayList<>(); swaggerProperties().getAuthorization().getTokenUrlList().forEach(tokenUrl -> grantTypes.add(new ResourceOwnerPasswordCredentialsGrant(tokenUrl))); return new OAuth(swaggerProperties().getAuthorization().getName(), authorizationScopeList, grantTypes); }