Skip to content

Commit

Permalink
Merge pull request #1813 from matrix-org/mauroromito/helper_function_…
Browse files Browse the repository at this point in the history
…to_generate_mas_logout_url

Helper function to generate the logout url for devices on MAS
  • Loading branch information
Velin92 authored Aug 25, 2023
2 parents e03fa9d + 6208987 commit 8b5256c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 14 additions & 0 deletions MatrixSDK/JSONModels/AutoDiscovery/MXWellKnownAuthentication.m
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions changelog.d/pr-1813.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Function that allows to generate from the well known authentication, a logout mas URL given the device ID.

0 comments on commit 8b5256c

Please sign in to comment.