Skip to content

Commit

Permalink
fix: rework cache directory
Browse files Browse the repository at this point in the history
  • Loading branch information
at88mph committed Oct 3, 2024
1 parent 140c651 commit 19b8882
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cadc-gms/src/main/java/org/opencadc/auth/OIDCDiscovery.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
*/
public class OIDCDiscovery {
private static final Logger log = Logger.getLogger(OIDCDiscovery.class);
private static final String CACHE_DIRECTORY_NAME = "cadc-gms";
private static final String CACHE_DIRECTORY_NAME = "cadc-gms-1.0";
private static final String WELL_KNOWN_ENDPOINT = "/.well-known/openid-configuration";

final URI issuer;
Expand All @@ -101,8 +101,11 @@ public CachingFile getCachingFile() throws MalformedURLException {
private File getCachedFile() {
final Path baseCacheDir = getBaseCacheDirectory();
final String issuerAuthority = this.issuer.getAuthority();
final String resourceCacheDir = baseCacheDir + issuerAuthority;
final Path path = Paths.get(resourceCacheDir, this.issuer.getPath(), "well-known.json");
final Path resourceCacheDir = Paths.get(baseCacheDir.toString(), issuerAuthority);

// Create a path to the cache file itself
// .../cadc-gms-1.0/<identity-provider-authority>/<identity-provider-path>/.well-known/openid-configuration
final Path path = Paths.get(resourceCacheDir.toString(), this.issuer.getPath(), OIDCDiscovery.WELL_KNOWN_ENDPOINT);
log.debug("Caching file [" + path + "] in dir [" + resourceCacheDir + "]");

return path.toFile();
Expand Down

0 comments on commit 19b8882

Please sign in to comment.