use of com.microsoft.identity.common.internal.util.ClockSkewManager in project microsoft-authentication-library-common-for-android by AzureAD.
the class ClockSkewManagerTest method testToClientTime.
@Test
public void testToClientTime() {
clockSkewManager = new ClockSkewManager(context) {
@Override
public long getSkewMillis() {
return 42L;
}
};
assertEquals(67932L, clockSkewManager.toClientTime(67890).getTime());
}
use of com.microsoft.identity.common.internal.util.ClockSkewManager in project microsoft-authentication-library-common-for-android by AzureAD.
the class ClockSkewManagerTest method testGetReferenceTime.
@Test
public void testGetReferenceTime() {
clockSkewManager = new ClockSkewManager(context) {
@Override
public Date getCurrentClientTime() {
return new Date(67890);
}
@Override
public long getSkewMillis() {
return 42L;
}
};
assertEquals(67848L, clockSkewManager.getAdjustedReferenceTime().getTime());
}
use of com.microsoft.identity.common.internal.util.ClockSkewManager in project microsoft-authentication-library-common-for-android by AzureAD.
the class ClockSkewManagerTest method testToReferenceTime.
@Test
public void testToReferenceTime() {
clockSkewManager = new ClockSkewManager(context) {
@Override
public long getSkewMillis() {
return 42L;
}
};
assertEquals(67848L, clockSkewManager.toReferenceTime(67890).getTime());
}
use of com.microsoft.identity.common.internal.util.ClockSkewManager in project microsoft-authentication-library-common-for-android by AzureAD.
the class ClockSkewManagerTest method testOnTimestampReceived.
@Test
public void testOnTimestampReceived() {
clockSkewManager = new ClockSkewManager(context) {
@Override
public Date getCurrentClientTime() {
return new Date(12345);
}
};
final Date serverTime = new Date(67890);
clockSkewManager.onTimestampReceived(serverTime.getTime());
assertEquals(-55545, clockSkewManager.getSkewMillis());
}
use of com.microsoft.identity.common.internal.util.ClockSkewManager in project microsoft-authentication-library-common-for-android by AzureAD.
the class MsalBrokerRequestAdapter method getAuthenticationScheme.
@NonNull
private static AbstractAuthenticationScheme getAuthenticationScheme(@NonNull final Context context, @NonNull final BrokerRequest request) {
final AbstractAuthenticationScheme requestScheme = request.getAuthenticationScheme();
if (null == requestScheme) {
// Default assumes the scheme is Bearer
return new BearerAuthenticationSchemeInternal();
} else {
if (requestScheme instanceof PopAuthenticationSchemeInternal) {
final IClockSkewManager clockSkewManager = new ClockSkewManager(context);
((PopAuthenticationSchemeInternal) requestScheme).setClockSkewManager(clockSkewManager);
}
return requestScheme;
}
}
Aggregations