TF-2387 Handle signIn twake workplace via use company server
This commit is contained in:
@@ -37,26 +37,19 @@ class TokenOIDC with EquatableMixin {
|
||||
throw AccessTokenIsNullException();
|
||||
}
|
||||
|
||||
final refreshToken = queryParams['refresh_token'];
|
||||
if (refreshToken == null || refreshToken.isEmpty) {
|
||||
throw RefreshTokenIsNullException();
|
||||
}
|
||||
|
||||
final idToken = queryParams['id_token'];
|
||||
if (idToken == null || idToken.isEmpty) {
|
||||
throw TokenIdIsNullException();
|
||||
}
|
||||
|
||||
final refreshToken = queryParams['refresh_token'] ?? '';
|
||||
final idToken = queryParams['id_token'] ?? '';
|
||||
final expiresIn = queryParams['expires_in'];
|
||||
if (expiresIn == null || expiresIn.isEmpty) {
|
||||
throw ExpiresTimeIsNullException();
|
||||
}
|
||||
|
||||
final expiredTime = expiresIn == null
|
||||
? null
|
||||
: DateTime.now().add(Duration(seconds: int.parse(expiresIn)));
|
||||
|
||||
return TokenOIDC(
|
||||
accessToken,
|
||||
TokenId(idToken),
|
||||
refreshToken,
|
||||
expiredTime: DateTime.now().add(Duration(seconds: int.parse(expiresIn))),
|
||||
expiredTime: expiredTime,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,24 +20,6 @@ void main() {
|
||||
expect(() => TokenOIDC.fromUri(uriString), throwsA(isA<AccessTokenIsNullException>()));
|
||||
});
|
||||
|
||||
test('throws RefreshTokenIsNullException if refresh_token is missing', () {
|
||||
const uriString = 'https://example.com/callback?access_token=valid_access&id_token=valid_id&expires_in=3600';
|
||||
|
||||
expect(() => TokenOIDC.fromUri(uriString), throwsA(isA<RefreshTokenIsNullException>()));
|
||||
});
|
||||
|
||||
test('throws TokenIdIsNullException if id_token is missing', () {
|
||||
const uriString = 'https://example.com/callback?access_token=valid_access&refresh_token=valid_refresh&expires_in=3600';
|
||||
|
||||
expect(() => TokenOIDC.fromUri(uriString), throwsA(isA<TokenIdIsNullException>()));
|
||||
});
|
||||
|
||||
test('throws ExpiresTimeIsNullException if expires_in is missing', () {
|
||||
const uriString = 'https://example.com/callback?access_token=valid_access&refresh_token=valid_refresh&id_token=valid_id';
|
||||
|
||||
expect(() => TokenOIDC.fromUri(uriString), throwsA(isA<ExpiresTimeIsNullException>()));
|
||||
});
|
||||
|
||||
test('throws FormatException on invalid URL format', () {
|
||||
const uriString = '::Not valid URI::';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user