Skip to content

Commit

Permalink
Fix OffsetDateTime parsing in IdentityClient (#4031)
Browse files Browse the repository at this point in the history
  • Loading branch information
jianghaolu authored and sima-zhu committed Jun 27, 2019
1 parent 553b20b commit ae568a3
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.nio.file.Files;
import java.nio.file.Paths;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.util.Random;
import java.util.Scanner;
import java.util.concurrent.ExecutorService;
Expand Down Expand Up @@ -78,7 +79,7 @@ public Mono<AccessToken> authenticateWithClientSecret(String tenantId, String cl
resource,
new ClientCredential(clientId, clientSecret),
Adal4jUtil.authenticationDelegate(callback));
}).map(ar -> new AccessToken(ar.getAccessToken(), OffsetDateTime.from(ar.getExpiresOnDate().toInstant())))
}).map(ar -> new AccessToken(ar.getAccessToken(), OffsetDateTime.ofInstant(ar.getExpiresOnDate().toInstant(), ZoneOffset.UTC)))
.doFinally(s -> executor.shutdown());
}

Expand All @@ -105,7 +106,7 @@ public Mono<AccessToken> authenticateWithPfxCertificate(String tenantId, String
} catch (IOException e) {
callback.error(e);
}
}).map(ar -> new AccessToken(ar.getAccessToken(), OffsetDateTime.from(ar.getExpiresOnDate().toInstant())))
}).map(ar -> new AccessToken(ar.getAccessToken(), OffsetDateTime.ofInstant(ar.getExpiresOnDate().toInstant(), ZoneOffset.UTC)))
.doFinally(s -> executor.shutdown());
}

Expand All @@ -131,7 +132,7 @@ public Mono<AccessToken> authenticateWithPemCertificate(String tenantId, String
} catch (IOException e) {
callback.error(e);
}
}).map(ar -> new AccessToken(ar.getAccessToken(), OffsetDateTime.from(ar.getExpiresOnDate().toInstant())))
}).map(ar -> new AccessToken(ar.getAccessToken(), OffsetDateTime.ofInstant(ar.getExpiresOnDate().toInstant(), ZoneOffset.UTC)))
.doFinally(s -> executor.shutdown());
}

Expand Down

0 comments on commit ae568a3

Please sign in to comment.