Skip to content

Commit cb495c5

Browse files
committed
fix formatting, removed default key generator and added a bean.
1 parent 27d950c commit cb495c5

3 files changed

Lines changed: 29 additions & 24 deletions

File tree

auth/pom.xml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
<artifactId>feast-common</artifactId>
2929
<version>${project.version}</version>
3030
</dependency>
31-
<dependency>
32-
<groupId>org.springframework</groupId>
33-
<artifactId>spring-context-support</artifactId>
34-
</dependency>
31+
<dependency>
32+
<groupId>org.springframework</groupId>
33+
<artifactId>spring-context-support</artifactId>
34+
</dependency>
3535
<dependency>
3636
<groupId>net.devh</groupId>
3737
<artifactId>grpc-server-spring-boot-starter</artifactId>
@@ -96,16 +96,16 @@
9696
<version>3.0.2</version>
9797
</dependency>
9898
<dependency>
99-
<groupId>org.springframework</groupId>
100-
<artifactId>spring-test</artifactId>
101-
<scope>test</scope>
102-
</dependency>
103-
<dependency>
104-
<groupId>org.mockito</groupId>
105-
<artifactId>mockito-core</artifactId>
106-
<version>${mockito.version}</version>
107-
<scope>test</scope>
108-
</dependency>
99+
<groupId>org.springframework</groupId>
100+
<artifactId>spring-test</artifactId>
101+
<scope>test</scope>
102+
</dependency>
103+
<dependency>
104+
<groupId>org.mockito</groupId>
105+
<artifactId>mockito-core</artifactId>
106+
<version>${mockito.version}</version>
107+
<scope>test</scope>
108+
</dependency>
109109
</dependencies>
110110
<build>
111111
<plugins>

auth/src/main/java/feast/auth/authorization/HttpAuthorizationProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public HttpAuthorizationProvider(Map<String, String> options) {
7171
* @param authentication Spring Security Authentication object
7272
* @return AuthorizationResult result of authorization query
7373
*/
74-
@Cacheable(value = CacheConfiguration.AUTHORIZATION_CACHE)
74+
@Cacheable(value = CacheConfiguration.AUTHORIZATION_CACHE, keyGenerator = "authKeyGenerator")
7575
public AuthorizationResult checkAccessToProject(String projectId, Authentication authentication) {
7676

7777
CheckAccessRequest checkAccessRequest = new CheckAccessRequest();

auth/src/main/java/feast/auth/config/CacheConfiguration.java

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,12 @@ protected Cache createConcurrentMapCache(final String name) {
7272
return cacheManager;
7373
}
7474

75-
@Override
76-
public CacheResolver cacheResolver() {
77-
// TODO Auto-generated method stub
78-
return null;
79-
}
80-
8175
/*
82-
* KeyGenerator for HttpAuthorizationProvider.checkAccessToProject() Method.
76+
* KeyGenerator used by {@link Cacheable} for caching authorization requests.
8377
* Key format : checkAccessToProject-<projectId>-<subjectClaim>
8478
*/
85-
@Override
86-
public KeyGenerator keyGenerator() {
79+
@Bean
80+
public KeyGenerator authKeyGenerator() {
8781
return (Object target, Method method, Object... params) -> {
8882
String projectId = (String) params[0];
8983
Authentication authentication = (Authentication) params[1];
@@ -94,6 +88,17 @@ public KeyGenerator keyGenerator() {
9488
};
9589
}
9690

91+
@Override
92+
public CacheResolver cacheResolver() {
93+
// TODO Auto-generated method stub
94+
return null;
95+
}
96+
97+
@Override
98+
public KeyGenerator keyGenerator() {
99+
return null;
100+
}
101+
97102
@Override
98103
public CacheErrorHandler errorHandler() {
99104
// TODO Auto-generated method stub

0 commit comments

Comments
 (0)