mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
apim seperation
This commit is contained in:
parent
dad3a34a27
commit
f1e75d9375
@ -73,7 +73,7 @@ public class OAuthRequestInterceptor implements RequestInterceptor {
|
||||
this.globalProperties = globalProperties;
|
||||
try {
|
||||
deviceMgtServerUrl = getDeviceMgtServerUrl(globalProperties);
|
||||
refreshTimeOffset = getRefreshTimeOffset(globalProperties);
|
||||
refreshTimeOffset = getRefreshTimeOffset(globalProperties) * 1000;
|
||||
username = getUsername(globalProperties);
|
||||
password = getPassword(globalProperties);
|
||||
tokenEndpoint = getTokenEndpoint(globalProperties);
|
||||
@ -105,7 +105,7 @@ public class OAuthRequestInterceptor implements RequestInterceptor {
|
||||
.contract(new JAXRSContract()).encoder(new GsonEncoder()).decoder(new GsonDecoder())
|
||||
.target(TokenIssuerService.class, tokenEndpoint);
|
||||
tokenInfo = tokenIssuerService.getToken(PASSWORD_GRANT_TYPE, username, password, REQUIRED_SCOPE);
|
||||
tokenInfo.setExpires_in(System.currentTimeMillis() + tokenInfo.getExpires_in());
|
||||
tokenInfo.setExpires_in(System.currentTimeMillis() + (tokenInfo.getExpires_in() * 1000));
|
||||
}
|
||||
synchronized(this) {
|
||||
if (System.currentTimeMillis() + refreshTimeOffset > tokenInfo.getExpires_in()) {
|
||||
|
||||
@ -50,7 +50,7 @@ public class OAuthRequestInterceptor implements RequestInterceptor {
|
||||
* Creates an interceptor that authenticates all requests.
|
||||
*/
|
||||
public OAuthRequestInterceptor() {
|
||||
refreshTimeOffset = AuthorizationConfigurationManager.getInstance().getTokenRefreshTimeOffset();
|
||||
refreshTimeOffset = AuthorizationConfigurationManager.getInstance().getTokenRefreshTimeOffset() * 1000;
|
||||
String username = AuthorizationConfigurationManager.getInstance().getUsername();
|
||||
String password = AuthorizationConfigurationManager.getInstance().getPassword();
|
||||
apiApplicationRegistrationService = Feign.builder().requestInterceptor(
|
||||
@ -81,7 +81,7 @@ public class OAuthRequestInterceptor implements RequestInterceptor {
|
||||
.target(TokenIssuerService.class,
|
||||
AuthorizationConfigurationManager.getInstance().getTokenEndpoint());
|
||||
tokenInfo = tokenIssuerService.getToken(PASSWORD_GRANT_TYPE, username, password, REQUIRED_SCOPE);
|
||||
tokenInfo.setExpires_in(System.currentTimeMillis() + tokenInfo.getExpires_in());
|
||||
tokenInfo.setExpires_in(System.currentTimeMillis() + (tokenInfo.getExpires_in() * 1000));
|
||||
}
|
||||
synchronized (this) {
|
||||
if (System.currentTimeMillis() + refreshTimeOffset > tokenInfo.getExpires_in()) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user