mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
Updating the apk file to switch between event enabling and disabling
This commit is contained in:
parent
5eefdfc2c0
commit
ec5936d013
@ -76,6 +76,7 @@ public class OAuthRequestInterceptor implements RequestInterceptor {
|
||||
.target(ApiApplicationRegistrationService.class,
|
||||
deviceMgtServerUrl + API_APPLICATION_REGISTRATION_CONTEXT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(RequestTemplate template) {
|
||||
if (tokenInfo == null) {
|
||||
@ -95,10 +96,12 @@ public class OAuthRequestInterceptor implements RequestInterceptor {
|
||||
tokenInfo = tokenIssuerService.getToken(PASSWORD_GRANT_TYPE, username, password);
|
||||
tokenInfo.setExpires_in(System.currentTimeMillis() + tokenInfo.getExpires_in());
|
||||
}
|
||||
synchronized(tokenInfo) {
|
||||
if (System.currentTimeMillis() + refreshTimeOffset > tokenInfo.getExpires_in()) {
|
||||
tokenInfo = tokenIssuerService.getToken(REFRESH_GRANT_TYPE, tokenInfo.getRefresh_token());
|
||||
tokenInfo.setExpires_in(System.currentTimeMillis() + tokenInfo.getExpires_in());
|
||||
}
|
||||
}
|
||||
String headerValue = "Bearer " + tokenInfo.getAccess_token();
|
||||
template.header("Authorization", headerValue);
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user