Skip to content

Commit

Permalink
Merge pull request #269 from b123400/production-domain
Browse files Browse the repository at this point in the history
Use production domain
  • Loading branch information
zdavatz authored Aug 12, 2023
2 parents 9a0887f + 2b2ac59 commit 02f8d5f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion AmiKoOSX/MLADSwissOAuthWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ - (void)receivedTokens:(id)tokens {
[[MLPersistenceManager shared] setHINADSwissTokens:tokens];
typeof(self) __weak _self = self;
dispatch_async(dispatch_get_main_queue(), ^{
[self.window.sheetParent endSheet:self.window
[_self.window.sheetParent endSheet:_self.window
returnCode:NSModalResponseOK];
});
}
Expand Down
12 changes: 10 additions & 2 deletions HINClient/MLHINClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ - (NSURL *)authURLForADSwiss {
];
}

- (NSString*)HINDomainForADSwiss {
#ifdef DEBUG
return @"oauth2.ci-prep.adswiss.hin.ch";
#else
return @"oauth2.ci.adswiss.hin.ch";
#endif
}

- (void)fetchAccessTokenWithAuthCode:(NSString *)authCode
completion:(void (^_Nonnull)(NSError * _Nullable error, MLHINTokens * _Nullable tokens))callback
{
Expand Down Expand Up @@ -171,7 +179,7 @@ - (void)fetchADSwissSAMLWithToken:(MLHINTokens *)token completion:(void (^_Nonnu
callback(error, nil);
return;
}
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"https://oauth2.ci-prep.adswiss.hin.ch/authService/EPDAuth?targetUrl=http%3A%2F%2Flocalhost%3A8080%2Fcallback&style=redirect"]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://%@/authService/EPDAuth?targetUrl=http://localhost:8080/callback&style=redirect", [self HINDomainForADSwiss]]]];
[request setAllHTTPHeaderFields:@{
@"Accept": @"application/json",
@"Authorization": [NSString stringWithFormat:@"Bearer %@", token.accessToken],
Expand Down Expand Up @@ -208,7 +216,7 @@ - (void)fetchADSwissAuthHandleWithToken:(MLHINTokens *)token
callback(error, nil);
return;
}
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"https://oauth2.ci-prep.adswiss.hin.ch/authService/EPDAuth/auth_handle"]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://%@/authService/EPDAuth/auth_handle", [self HINDomainForADSwiss]]]];
[request setAllHTTPHeaderFields:@{
@"Accept": @"application/json",
@"Content-Type": @"application/json",
Expand Down

0 comments on commit 02f8d5f

Please sign in to comment.