NONRTRIC PMS, Bugfix 87/130187/1
authorPatrikBuhr <patrik.buhr@est.tech>
Fri, 5 Aug 2022 06:27:39 +0000 (08:27 +0200)
committerPatrikBuhr <patrik.buhr@est.tech>
Fri, 5 Aug 2022 06:35:54 +0000 (08:35 +0200)
If the auth-token-file parameter in the file application.yaml is missing, it would not default to an empty file name.

Issue-ID: CCSDK-3683
Signed-off-by: PatrikBuhr <patrik.buhr@est.tech>
Change-Id: I6957762ac0df2c159a8273f3bf161b1a68ab85e7

a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/SecurityContext.java

index 3566aad..fe7c11f 100644 (file)
@@ -47,7 +47,7 @@ public class SecurityContext {
     @Setter
     private Path authTokenFilePath;
 
-    public SecurityContext(@Value("${app.auth-token-file:\"\"}") String authTokenFilename) {
+    public SecurityContext(@Value("${app.auth-token-file:}") String authTokenFilename) {
         if (!authTokenFilename.isEmpty()) {
             this.authTokenFilePath = Path.of(authTokenFilename);
         }
@@ -63,7 +63,7 @@ public class SecurityContext {
         }
         try {
             long lastModified = authTokenFilePath.toFile().lastModified();
-            if (lastModified != this.tokenTimestamp) {
+            if (tokenTimestamp == 0 || lastModified != this.tokenTimestamp) {
                 this.authToken = Files.readString(authTokenFilePath);
                 this.tokenTimestamp = lastModified;
             }