diff --git a/MatrixSDK/JSONModels/AutoDiscovery/MXWellKnownAuthentication.h b/MatrixSDK/JSONModels/AutoDiscovery/MXWellKnownAuthentication.h index b224edf4e..23a7c2522 100644 --- a/MatrixSDK/JSONModels/AutoDiscovery/MXWellKnownAuthentication.h +++ b/MatrixSDK/JSONModels/AutoDiscovery/MXWellKnownAuthentication.h @@ -33,6 +33,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly) NSString *issuer; @property (nonatomic, readonly, nullable) NSString *account; +-(NSURL * _Nullable) getMasLogoutDeviceURLFromDeviceID: (NSString * ) deviceID; + @end NS_ASSUME_NONNULL_END diff --git a/MatrixSDK/JSONModels/AutoDiscovery/MXWellKnownAuthentication.m b/MatrixSDK/JSONModels/AutoDiscovery/MXWellKnownAuthentication.m index 2cce0def7..03dc13695 100644 --- a/MatrixSDK/JSONModels/AutoDiscovery/MXWellKnownAuthentication.m +++ b/MatrixSDK/JSONModels/AutoDiscovery/MXWellKnownAuthentication.m @@ -45,6 +45,23 @@ + (instancetype)modelFromJSON:(NSDictionary *)JSONDictionary return wellKnownAuthentication; } +-(NSURL * _Nullable) getMasLogoutDeviceURLFromDeviceID: (NSString * ) deviceID +{ + if (_account) + { + NSURLComponents *components = [NSURLComponents componentsWithString:_account]; + components.queryItems = @[ + [NSURLQueryItem queryItemWithName:@"device_id" value:deviceID], + [NSURLQueryItem queryItemWithName:@"action" value:@"session_end"] + ]; + return components.URL; + } + else + { + return nil; + } +} + #pragma mark - NSCoding