Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply the 'matchesRedirectionURL' checks to consider a path value of …
…"/" as equal to an empty path of "".
  • Loading branch information
AlexPlekhov committed Aug 18, 2022
commit 92d86458fed54736f42ad83927a9a98593a3df47
10 changes: 6 additions & 4 deletions Source/AppAuthCore/OIDAuthorizationService.m
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,19 @@ - (void)cancelWithCompletion:(nullable void (^)(void))completion {
+ (BOOL)URL:(NSURL *)URL matchesRedirectionURL:(NSURL *)redirectionURL {
NSURL *standardizedURL = [URL standardizedURL];
NSURL *standardizedRedirectURL = [redirectionURL standardizedURL];
NSString *trimmedStdUrlPath = [standardizedURL.path stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"/"]];
NSString *stdRedirectUrlPath = [standardizedRedirectURL.path stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"/"]];

NSString *normalizedPath = [standardizedURL.path isEqualToString:@"/"] ? @""
Comment thread
AlexPlekhov marked this conversation as resolved.
: standardizedURL.path;
Comment thread
AlexPlekhov marked this conversation as resolved.
Outdated
NSString *normalizedRedirectPath = [standardizedRedirectURL.path isEqualToString:@"/"] ? @""
: standardizedRedirectURL.path;
Comment thread
AlexPlekhov marked this conversation as resolved.
Outdated

return [standardizedURL.scheme caseInsensitiveCompare:standardizedRedirectURL.scheme] == NSOrderedSame
&& OIDIsEqualIncludingNil(standardizedURL.user, standardizedRedirectURL.user)
&& OIDIsEqualIncludingNil(standardizedURL.password, standardizedRedirectURL.password)
&& OIDIsEqualIncludingNil(standardizedURL.host, standardizedRedirectURL.host)
&& OIDIsEqualIncludingNil(standardizedURL.port, standardizedRedirectURL.port)
&& OIDIsEqualIncludingNil(trimmedStdUrlPath, stdRedirectUrlPath);
&& OIDIsEqualIncludingNil(normalizedPath, normalizedRedirectPath);
}

- (BOOL)shouldHandleURL:(NSURL *)URL {
return [[self class] URL:URL matchesRedirectionURL:_request.redirectURL];
}
Expand Down