diff --git a/MatrixSDK/JSONModels/AutoDiscovery/MXWellKnownAuthentication.h b/MatrixSDK/JSONModels/AutoDiscovery/MXWellKnownAuthentication.h index b224edf4e..9c483c65e 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) getLogoutDeviceURLFromID: (NSString * ) deviceID; + @end NS_ASSUME_NONNULL_END diff --git a/MatrixSDK/JSONModels/AutoDiscovery/MXWellKnownAuthentication.m b/MatrixSDK/JSONModels/AutoDiscovery/MXWellKnownAuthentication.m index 2cce0def7..fe2cdbdf6 100644 --- a/MatrixSDK/JSONModels/AutoDiscovery/MXWellKnownAuthentication.m +++ b/MatrixSDK/JSONModels/AutoDiscovery/MXWellKnownAuthentication.m @@ -45,6 +45,20 @@ + (instancetype)modelFromJSON:(NSDictionary *)JSONDictionary return wellKnownAuthentication; } +-(NSURL * _Nullable) getLogoutDeviceURLFromID: (NSString * ) deviceID +{ + if (!_account) + { + return nil; + } + NSURLComponents *components = [NSURLComponents componentsWithString:_account]; + components.queryItems = @[ + [NSURLQueryItem queryItemWithName:@"device_id" value:deviceID], + [NSURLQueryItem queryItemWithName:@"action" value:@"session_end"] + ]; + return components.URL; +} + #pragma mark - NSCoding diff --git a/changelog.d/pr-1813.feature b/changelog.d/pr-1813.feature new file mode 100644 index 000000000..b3859bb97 --- /dev/null +++ b/changelog.d/pr-1813.feature @@ -0,0 +1 @@ +Function that allows to generate from the well known authentication, a logout mas URL given the device ID. \ No newline at end of file