TF-571 Setup and get OIDC configuration

This commit is contained in:
dab246
2022-05-20 13:35:03 +07:00
committed by Dat H. Pham
parent 239234f836
commit ffb5cadc16
17 changed files with 177 additions and 5 deletions
+2 -1
View File
@@ -76,4 +76,5 @@ export 'identity/identity_request_dto.dart';
// OIDC
export 'oidc/response/oidc_response.dart';
export 'oidc/response/oidc_link_dto.dart';
export 'oidc/request/oidc_request.dart';
export 'oidc/request/oidc_request.dart';
export 'oidc/oidc_configuration.dart';
+41
View File
@@ -0,0 +1,41 @@
import 'package:equatable/equatable.dart';
class OIDCConfiguration with EquatableMixin {
static const redirectOidc = 'teammail.mobile://oauthredirect';
static const wellKnownOpenId = '.well-known/openid-configuration';
final String authority;
final String clientId;
final String redirectUrl = redirectOidc;
final List<String> scopes;
OIDCConfiguration({
required this.authority,
required this.clientId,
required this.scopes
});
factory OIDCConfiguration.initial() {
return OIDCConfiguration(
authority: 'https://auth.upn.integration-open-paas.org/auth/realms/mobile',
clientId: 'teammail-mobile',
scopes: ['openid', 'offline_access']
);
}
String get discoveryUrl {
if (authority.endsWith('/')) {
return authority + wellKnownOpenId;
} else {
return authority + '/' + wellKnownOpenId;
}
}
@override
List<Object?> get props => [
authority,
clientId,
scopes
];
}