TF-571 Get token from authentication sso
This commit is contained in:
@@ -77,4 +77,7 @@ export 'identity/identity_request_dto.dart';
|
||||
export 'oidc/response/oidc_response.dart';
|
||||
export 'oidc/response/oidc_link_dto.dart';
|
||||
export 'oidc/request/oidc_request.dart';
|
||||
export 'oidc/oidc_configuration.dart';
|
||||
export 'oidc/oidc_configuration.dart';
|
||||
export 'oidc/token_id.dart';
|
||||
export 'oidc/token_oidc.dart';
|
||||
export 'oidc/token.dart';
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:model/oidc/token_id.dart';
|
||||
|
||||
class Token extends Equatable {
|
||||
const Token(this.token, this.tokenId);
|
||||
|
||||
final String token;
|
||||
final TokenId tokenId;
|
||||
|
||||
@override
|
||||
List<Object> get props => [token, tokenId];
|
||||
}
|
||||
|
||||
extension TokenExtension on Token {
|
||||
bool isTokenValid() => token.isNotEmpty && tokenId.uuid.isNotEmpty;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class TokenId with EquatableMixin {
|
||||
final String uuid;
|
||||
|
||||
TokenId(this.uuid);
|
||||
|
||||
@override
|
||||
List<Object> get props => [uuid];
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:model/oidc/token.dart';
|
||||
import 'package:model/oidc/token_id.dart';
|
||||
|
||||
class TokenOIDC with EquatableMixin {
|
||||
|
||||
final String token;
|
||||
final TokenId tokenId;
|
||||
final DateTime? expiredTime;
|
||||
final String refreshToken;
|
||||
|
||||
TokenOIDC(
|
||||
this.token,
|
||||
this.tokenId,
|
||||
this.refreshToken,
|
||||
{this.expiredTime}
|
||||
);
|
||||
|
||||
factory TokenOIDC.empty() {
|
||||
return TokenOIDC('', TokenId(''), '');
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [token, tokenId, expiredTime, refreshToken];
|
||||
}
|
||||
|
||||
extension TokenOIDCExtension on TokenOIDC {
|
||||
|
||||
bool isTokenValid() => token.isNotEmpty && tokenId.uuid.isNotEmpty;
|
||||
|
||||
Token toToken() {
|
||||
return Token(token, tokenId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user