mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-22 01:22:46 +02:00
Use ASWebAuthenticationSession to display OIDC account management URL (#7671)
Co-authored-by: Doug <douglase@element.io>
This commit is contained in:
@@ -204,7 +204,8 @@ SettingsIdentityServerCoordinatorBridgePresenterDelegate,
|
||||
ServiceTermsModalCoordinatorBridgePresenterDelegate,
|
||||
TableViewSectionsDelegate,
|
||||
ThreadsBetaCoordinatorBridgePresenterDelegate,
|
||||
ChangePasswordCoordinatorBridgePresenterDelegate>
|
||||
ChangePasswordCoordinatorBridgePresenterDelegate,
|
||||
SSOAuthenticationPresenterDelegate>
|
||||
{
|
||||
// Current alert (if any).
|
||||
__weak UIAlertController *currentAlert;
|
||||
@@ -300,6 +301,8 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
|
||||
@property (nonatomic) BOOL isPreparingIdentityService;
|
||||
@property (nonatomic, strong) ServiceTermsModalCoordinatorBridgePresenter *serviceTermsModalCoordinatorBridgePresenter;
|
||||
|
||||
@property (nonatomic, strong) SSOAuthenticationPresenter *ssoAuthenticationPresenter;
|
||||
|
||||
@property (nonatomic) AnalyticsScreenTracker *screenTracker;
|
||||
|
||||
@end
|
||||
@@ -3926,7 +3929,12 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
|
||||
{
|
||||
NSURL *url = [NSURL URLWithString: self.mainSession.homeserverWellknown.authentication.account];
|
||||
if (url) {
|
||||
[UIApplication.sharedApplication openURL:url options:@{} completionHandler:nil];
|
||||
SSOAccountService *service = [[SSOAccountService alloc] initWithAccountURL:url];
|
||||
SSOAuthenticationPresenter *presenter = [[SSOAuthenticationPresenter alloc] initWithSsoAuthenticationService:service];
|
||||
presenter.delegate = self;
|
||||
self.ssoAuthenticationPresenter = presenter;
|
||||
|
||||
[presenter presentForIdentityProvider:nil with:@"" from:self animated:YES];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4602,4 +4610,26 @@ ChangePasswordCoordinatorBridgePresenterDelegate>
|
||||
[self.userSessionsFlowCoordinatorBridgePresenter pushFrom:self.navigationController animated:YES];
|
||||
}
|
||||
|
||||
#pragma mark - SSOAuthenticationPresenterDelegate
|
||||
|
||||
- (void)ssoAuthenticationPresenterDidCancel:(SSOAuthenticationPresenter *)presenter
|
||||
{
|
||||
self.ssoAuthenticationPresenter = nil;
|
||||
MXLogDebug(@"OIDC account management complete.")
|
||||
}
|
||||
|
||||
- (void)ssoAuthenticationPresenter:(SSOAuthenticationPresenter *)presenter authenticationDidFailWithError:(NSError *)error
|
||||
{
|
||||
self.ssoAuthenticationPresenter = nil;
|
||||
MXLogError(@"OIDC account management failed.")
|
||||
}
|
||||
|
||||
- (void)ssoAuthenticationPresenter:(SSOAuthenticationPresenter *)presenter
|
||||
authenticationSucceededWithToken:(NSString *)token
|
||||
usingIdentityProvider:(SSOIdentityProvider *)identityProvider
|
||||
{
|
||||
self.ssoAuthenticationPresenter = nil;
|
||||
MXLogWarning(@"Unexpected callback after OIDC account management.")
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user