Skip to content

Commit

Permalink
helper function to generate the logout url
Browse files Browse the repository at this point in the history
  • Loading branch information
Velin92 committed Aug 25, 2023
1 parent 7c04167 commit 5fc236c
Show file tree
Hide file tree
Showing 2 changed files with 19 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) getMasLogoutDeviceURLFromDeviceID: (NSString * ) deviceID;

@end

NS_ASSUME_NONNULL_END
17 changes: 17 additions & 0 deletions MatrixSDK/JSONModels/AutoDiscovery/MXWellKnownAuthentication.m
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 5fc236c

Please sign in to comment.