|
21 | 21 | import org.apache.jackrabbit.oak.namepath.NamePathMapper; |
22 | 22 | import org.apache.jackrabbit.oak.spi.security.SecurityConfiguration; |
23 | 23 | import org.apache.jackrabbit.oak.spi.security.principal.PrincipalProvider; |
| 24 | +import org.apache.jackrabbit.oak.spi.security.user.cache.CacheConstants; |
24 | 25 | import org.apache.jackrabbit.oak.spi.security.user.cache.CachePrincipalFactory; |
25 | 26 | import org.apache.jackrabbit.oak.spi.security.user.cache.CachedMembershipReader; |
26 | 27 | import org.jetbrains.annotations.NotNull; |
@@ -67,6 +68,26 @@ public interface UserConfiguration extends SecurityConfiguration { |
67 | 68 | PrincipalProvider getUserPrincipalProvider(@NotNull Root root, @NotNull NamePathMapper namePathMapper); |
68 | 69 |
|
69 | 70 |
|
| 71 | + /** |
| 72 | + * Optional method that allows a given user management implementation to |
| 73 | + * provide a specific and optimized implementation of the {@link CachedMembershipReader} |
| 74 | + * interface for the principals represented by the user/groups known to |
| 75 | + * this implementation. |
| 76 | + * |
| 77 | + * If this method returns {@code null} the security setup won't, by default, use |
| 78 | + * a cached membership reader. |
| 79 | + * |
| 80 | + * @param root The root used to read the principal information from. |
| 81 | + * @param cachePrincipalFactory The factory to create the principal from the cache. |
| 82 | + * @param propName The name of the property that contains the cache. |
| 83 | + * @return An implementation of {@code CachedMembershipReader} or {@code null} if the UserConfiguration implementation |
| 84 | + * does not provide a cached membership reader. |
| 85 | + */ |
| 86 | + @Nullable |
| 87 | + default CachedMembershipReader getCachedMembershipReader(@NotNull Root root, @NotNull CachePrincipalFactory cachePrincipalFactory, @NotNull String propName) { |
| 88 | + return getCachedMembershipReader(root, cachePrincipalFactory, propName, CacheConstants.REP_EXPIRATION); |
| 89 | + } |
| 90 | + |
70 | 91 | /** |
71 | 92 | * Optional method that allows a given user management implementation to |
72 | 93 | * provide a specific and optimized implementation of the {@link CachedMembershipReader} |
|
0 commit comments