Skip to content
Open
Changes from 4 commits
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
9 changes: 8 additions & 1 deletion Source/AppAuthCore/OIDAuthorizationService.m
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,20 @@ - (void)cancelWithCompletion:(nullable void (^)(void))completion {
+ (BOOL)URL:(NSURL *)URL matchesRedirectionURL:(NSURL *)redirectionURL {
NSURL *standardizedURL = [URL standardizedURL];
NSURL *standardizedRedirectURL = [redirectionURL standardizedURL];
// Some servers adds '/' to the end when there is no 'path'. To relax the equality rules below
// were decided to normalize pathes. So, pathes like '' are the same to '/' now.
// Read more https://github.com/openid/AppAuth-iOS/issues/446
NSString *normalizedPath = [standardizedURL.path isEqualToString:@"/"] ? @""
: standardizedURL.path;
NSString *normalizedRedirectPath = [standardizedRedirectURL.path isEqualToString:@"/"] ? @""
: standardizedRedirectURL.path;

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(standardizedURL.path, standardizedRedirectURL.path);
&& OIDIsEqualIncludingNil(normalizedPath, normalizedRedirectPath);
}

- (BOOL)shouldHandleURL:(NSURL *)URL {
Expand Down