Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ + (void)getAccessTokenForAuthority:(NSString *)authority
clientCredential:(NSString *)clientCredential
completionHandler:(void (^)(NSString *, NSError *))completionHandler
{
// Validate required parameters
if (!authority || !resource || !clientId || !clientCredential)
{
if (completionHandler)
{
NSError *error = MSIDCreateError(MSIDErrorDomain, MSIDErrorInternal, @"Missing required parameters for client credential flow.", nil, nil, nil, nil, nil, YES);
completionHandler(nil, error);
}
return;
}

MSIDLegacyTokenCacheKey *cacheKey = [[MSIDLegacyTokenCacheKey alloc] initWithAuthority:[NSURL URLWithString:authority]
clientId:clientId
resource:resource
Expand Down Expand Up @@ -91,6 +102,17 @@ + (void)getAccessTokenForAuthority:(NSString *)authorityString
certificatePassword:(NSString *)password
completionHandler:(void (^)(NSString *accessToken, NSError *error))completionHandler
{
// Validate required parameters
if (!authorityString || !resource || !clientId || !certificateData || !password)
{
if (completionHandler)
{
NSError *error = MSIDCreateError(MSIDErrorDomain, MSIDErrorInternal, @"Missing required parameters for certificate-based client credential flow.", nil, nil, nil, nil, nil, YES);
completionHandler(nil, error);
}
return;
}

MSIDLegacyTokenCacheKey *cacheKey = [[MSIDLegacyTokenCacheKey alloc] initWithAuthority:[NSURL URLWithString:authorityString]
clientId:clientId
resource:resource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ - (instancetype)initWithClientCertificateContents:(NSString *)certificate
defaultScopes:(NSDictionary *)defaultScopes
defaultResources:(NSDictionary *)defaultResources
operationAPIConf:(NSDictionary *)operationAPIConfiguration
functionAppAPIConf:(NSDictionary *)functionAppAPIConfiguration
jitConfig:(NSDictionary *)jitConfig
{
self = [super init];
Expand All @@ -76,10 +77,10 @@ - (instancetype)initWithClientCertificateContents:(NSString *)certificate
MSIDAutomationOperationAPIInMemoryCacheHandler *cacheHandler = [[MSIDAutomationOperationAPIInMemoryCacheHandler alloc] initWithDictionary:additionalConfigurations];

_operationAPIRequestHandler = [[MSIDAutomationOperationAPIRequestHandler alloc] initWithAPIPath:operationAPIConfiguration[@"operation_api_path"]

encodedCertificate:certificate
certificatePassword:password
operationAPIConfiguration:operationAPIConfiguration];
operationAPIConfiguration:operationAPIConfiguration
functionAppAPIConfiguration:functionAppAPIConfiguration];
_operationAPIRequestHandler.apiCacheHandler = cacheHandler;

_passwordRequestHandler = [MSIDAutomationPasswordRequestHandler new];
Expand Down Expand Up @@ -148,6 +149,7 @@ - (instancetype)initWithConfigurationPath:(NSString *)configurationPath
defaultScopes:configurationDictionary[@"scopes"]
defaultResources:configurationDictionary[@"resources"]
operationAPIConf:configurationDictionary[@"operation_api_conf"]
functionAppAPIConf:configurationDictionary[@"function_app_api_url"]
jitConfig:configurationDictionary[@"jit_intune_ids"]];

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ - (NSString *)requestOperationPath

- (NSString *)httpMethod
{
return @"DELETE";
return @"POST";
}

- (NSArray<NSURLQueryItem *> *)queryItems
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
- (instancetype)initWithAPIPath:(NSString *)apiPath
encodedCertificate:(NSString *)encodedCertificate
certificatePassword:(NSString *)certificatePassword
operationAPIConfiguration:(NSDictionary *)operationAPIConfiguration;
operationAPIConfiguration:(NSDictionary *)operationAPIConfiguration
functionAppAPIConfiguration:(NSDictionary *)functionAppAPIConfiguration;

- (void)executeAPIRequest:(MSIDAutomationBaseApiRequest *)apiRequest
responseHandler:(id<MSIDAutomationOperationAPIResponseHandler>)responseHandler
Expand Down
Loading
Loading