Skip to content

Commit

Permalink
Merge branch 'release/v2.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Pangrle committed Jan 18, 2017
2 parents 2d272c4 + f214ef9 commit 956c1d0
Show file tree
Hide file tree
Showing 161 changed files with 7,784 additions and 2,707 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode7.2
osx_image: xcode8.1

# Set up our rubygems (slather and xcpretty, namely)
install:
Expand Down
4 changes: 2 additions & 2 deletions ADAL.podspec
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Pod::Spec.new do |s|
s.name = "ADAL"
s.module_name = "ADAL"
s.version = "2.2.7"
s.version = "2.3.0"
s.summary = "The ADAL SDK for iOS gives you the ability to add Azure Identity authentication to your application"

s.description = <<-DESC
The Azure Identity Library for Objective C. This library gives you the ability to add support for Work Accounts to your iOS and OS X applications with just a few lines of additional code. This SDK gives your application the full functionality of Microsoft Azure AD, including industry standard protocol support for OAuth2, Web API integration with user level consent, and two factor authentication support.
The Azure Identity Library for Objective C. This library gives you the ability to add support for Work Accounts to your iOS and macOS applications with just a few lines of additional code. This SDK gives your application the full functionality of Microsoft Azure AD, including industry standard protocol support for OAuth2, Web API integration with user level consent, and two factor authentication support.
DESC
s.homepage = "https://github.com/AzureAD/azure-activedirectory-library-for-objc"
s.license = {
Expand Down
3 changes: 0 additions & 3 deletions ADAL.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

592 changes: 569 additions & 23 deletions ADAL/ADAL.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions ADAL/ADALAutomation/ADALAutomation.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright © Microsoft Open Technologies, Inc.
//
// All Rights Reserved
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
// ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
// PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
//
// See the Apache License, Version 2.0 for the specific language
// governing permissions and limitations under the License.

#pragma once

typedef void (^ADAutoParamBlock)(NSDictionary<NSString *, NSString *> * parameters);
27 changes: 27 additions & 0 deletions ADAL/ADALAutomation/ADAutoAppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright © Microsoft Open Technologies, Inc.
//
// All Rights Reserved
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
// ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
// PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
//
// See the Apache License, Version 2.0 for the specific language
// governing permissions and limitations under the License.

#import <UIKit/UIKit.h>

@interface ADAutoAppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;


@end

61 changes: 61 additions & 0 deletions ADAL/ADALAutomation/ADAutoAppDelegate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Copyright © Microsoft Open Technologies, Inc.
//
// All Rights Reserved
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
// ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
// PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
//
// See the Apache License, Version 2.0 for the specific language
// governing permissions and limitations under the License.

#import "ADAutoAppDelegate.h"

@interface ADAutoAppDelegate ()

@end

@implementation ADAutoAppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
return YES;
}


- (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}


- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}


- (void)applicationWillEnterForeground:(UIApplication *)application {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}


- (void)applicationDidBecomeActive:(UIApplication *)application {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}


- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}


@end
31 changes: 31 additions & 0 deletions ADAL/ADALAutomation/ADAutoInputViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright (c) Microsoft Corporation.
// All rights reserved.
//
// This code is licensed under the MIT License.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files(the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions :
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import <UIKit/UIKit.h>
#import "ADALAutomation.h"

@interface ADAutoInputViewController : UIViewController

- (id)initWithCompletionBlock:(ADAutoParamBlock)completionBlock;

@end
118 changes: 118 additions & 0 deletions ADAL/ADALAutomation/ADAutoInputViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
// Copyright (c) Microsoft Corporation.
// All rights reserved.
//
// This code is licensed under the MIT License.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files(the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions :
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import "ADAutoInputViewController.h"
#import "ADAutoTextAndButtonView.h"

@interface ADAutoInputViewController ()

@end

@implementation ADAutoInputViewController
{
ADAutoParamBlock _completionBlock;
ADAutoTextAndButtonView* _textAndButtonView;
}

- (id)initWithCompletionBlock:(ADAutoParamBlock)completionBlock
{
if (!(self = [super init]))
{
return nil;
}

_completionBlock = completionBlock;

return self;
}

- (void)loadView
{
UIView* contentView = [[UIView alloc] initWithFrame:UIScreen.mainScreen.bounds];
contentView.backgroundColor = UIColor.whiteColor;
self.view = contentView;
_textAndButtonView = [[ADAutoTextAndButtonView alloc] initWithFrame:UIScreen.mainScreen.bounds];
[contentView addSubview:_textAndButtonView];
[_textAndButtonView.actionButton addTarget:self
action:@selector(go:)
forControlEvents:UIControlEventTouchUpInside];

NSDictionary* views = @{ @"textAndButtonView" : _textAndButtonView,
@"topLayoutGuide" : self.topLayoutGuide,
@"bottomLayoutGuide" : self.bottomLayoutGuide };

NSArray* verticalConstraints =
[NSLayoutConstraint constraintsWithVisualFormat:@"V:[topLayoutGuide]-[textAndButtonView]-[bottomLayoutGuide]"
options:0
metrics:nil
views:views];

NSArray* horizontalConstraints =
[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[textAndButtonView]-|"
options:0
metrics:nil
views:views];

[self.view addConstraints:verticalConstraints];
[self.view addConstraints:horizontalConstraints];
}

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

- (IBAction)go:(id)sender
{
(void)sender;

@synchronized (self)
{
NSString* text = _textAndButtonView.textView.text;
NSError* error = nil;
NSDictionary* params = [NSJSONSerialization JSONObjectWithData:[text dataUsingEncoding:NSUTF8StringEncoding] options:0 error:&error];
if (!params)
{
params = @{ @"error" : error };
}

_completionBlock(params);
}
}

/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/

@end
25 changes: 25 additions & 0 deletions ADAL/ADALAutomation/ADAutoMainViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright © Microsoft Open Technologies, Inc.
//
// All Rights Reserved
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
// ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
// PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
//
// See the Apache License, Version 2.0 for the specific language
// governing permissions and limitations under the License.

#import <UIKit/UIKit.h>

@interface ADAutoMainViewController : UIViewController


@end

69 changes: 69 additions & 0 deletions ADAL/ADALAutomation/ADAutoMainViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Copyright © Microsoft Open Technologies, Inc.
//
// All Rights Reserved
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
// OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
// ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A
// PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
//
// See the Apache License, Version 2.0 for the specific language
// governing permissions and limitations under the License.

#import "ADAutoMainViewController.h"
#import "ADAutoParameterViewController.h"
#import "ADAutoInputViewController.h"
#import "ADAL_Internal.h"

@interface ADAutoMainViewController ()

@end

@implementation ADAutoMainViewController

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}


- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}


- (IBAction)acquireToken:(id)sender
{
/* ADAutoParameterViewController* paramController =
[[ADAutoParameterViewController alloc] initWithParameters:@[@"userId", @"authority", @"clientId", @"resource", @"redirectUri"]
completionBlock:^(NSDictionary<NSString *,NSString *> *parameters)*/
ADAutoInputViewController* inputController =
[[ADAutoInputViewController alloc] initWithCompletionBlock:^(NSDictionary<NSString *,NSString *> *parameters)
{
ADAuthenticationContext* context =
[[ADAuthenticationContext alloc] initWithAuthority:parameters[@"authority"]
validateAuthority:YES
error:nil];

[context acquireTokenWithResource:parameters[@"resource"]
clientId:parameters[@"clientId"]
redirectUri:[NSURL URLWithString:parameters[@"redirectUri"]]
completionBlock:^(ADAuthenticationResult *result)
{
NSLog(@"Yay! %@", result);
}];
}];

[self presentViewController:inputController animated:NO completion:^{
NSLog(@"presented!");
}];
}

@end
Loading

0 comments on commit 956c1d0

Please sign in to comment.