Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-tenant PkeyAuth support #1438

Merged
merged 11 commits into from
Feb 9, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [1.2.0]
* Multi-tenant PkeyAuth support in MSAL (#1438)

## [1.1.26]
* Added more string utils in common core (#1417)
* Fixed links in iframe to open in themselves instead of browser for embedded web views (#1424)
Expand Down
1 change: 1 addition & 0 deletions MSAL/MSAL Test App.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<string>$(AppIdentifierPrefix)com.microsoft.adalcache</string>
<string>$(AppIdentifierPrefix)com.microsoft.workplacejoin</string>
<string>$(AppIdentifierPrefix)com.microsoft.ssoseeding</string>
<string>$(AppIdentifierPrefix)com.microsoft.workplacejoin.v2</string>
</array>
</dict>
</plist>
2 changes: 1 addition & 1 deletion MSAL/resources/ios/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.1.26</string>
<string>1.2.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
Expand Down
2 changes: 1 addition & 1 deletion MSAL/resources/mac/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.1.26</string>
<string>1.2.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key>
Expand Down
4 changes: 2 additions & 2 deletions MSAL/src/MSAL_Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
//------------------------------------------------------------------------------

#define MSAL_VER_HIGH 1
#define MSAL_VER_LOW 1
#define MSAL_VER_PATCH 26
#define MSAL_VER_LOW 2
#define MSAL_VER_PATCH 0

#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
Expand Down
15 changes: 14 additions & 1 deletion MSAL/test/app/ios/MSALTestAppAcquireTokenViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
#define TEST_EMBEDDED_WEBVIEW_MSAL 0
#define TEST_EMBEDDED_WEBVIEW_CUSTOM 1

static NSString *const kDeviceIdClaimsValue = @"{\"access_token\":{\"deviceid\":{\"essential\":true}}}";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, in our code base, we have static variable names in the form of s_***, k*** as well as underscore-concatenated capitals, do we have any preference or guidance? :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't :) But good callout to have an agreement.


@interface MSALTestAppAcquireTokenViewController () <UITextFieldDelegate>

@property (nonatomic) IBOutlet UIButton *profileButton;
Expand All @@ -72,6 +74,7 @@ @interface MSALTestAppAcquireTokenViewController () <UITextFieldDelegate>
@property (nonatomic) IBOutlet UISegmentedControl *webviewTypeSegmentControl;
@property (nonatomic) IBOutlet UISegmentedControl *customWebviewTypeSegmentControl;
@property (nonatomic) IBOutlet UISegmentedControl *systemWebviewSSOSegmentControl;
@property (nonatomic) IBOutlet UISegmentedControl *claimsSegmentedControl;
@property (nonatomic) IBOutlet UITextView *resultTextView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *acquireButtonsViewBottomConstraint;
@property (nonatomic) IBOutlet UIView *customWebviewContainer;
Expand Down Expand Up @@ -219,7 +222,12 @@ - (MSALInteractiveTokenParameters *)tokenParams:(BOOL)isSSOSeedingCall
parameters.promptType = isSSOSeedingCall ? MSALPromptTypeDefault : [self promptTypeValue];

parameters.extraQueryParameters = isSSOSeedingCall ? [NSDictionary msidDictionaryFromWWWFormURLEncodedString:@"prompt=none"] : [NSDictionary msidDictionaryFromWWWFormURLEncodedString:self.extraQueryParamsTextField.text];


if (self.claimsSegmentedControl.selectedSegmentIndex == 1)
{
parameters.claimsRequest = [[MSALClaimsRequest alloc] initWithJsonString:kDeviceIdClaimsValue error:nil];
}

return parameters;
}

Expand Down Expand Up @@ -425,6 +433,11 @@ - (IBAction)onAcquireTokenSilentButtonTapped:(__unused id)sender
parameters.authenticationScheme = [[MSALAuthenticationSchemePop alloc] initWithHttpMethod:MSALHttpMethodPOST requestUrl:requestUrl nonce:nil additionalParameters:nil];
}

if (self.claimsSegmentedControl.selectedSegmentIndex == 1)
{
parameters.claimsRequest = [[MSALClaimsRequest alloc] initWithJsonString:kDeviceIdClaimsValue error:nil];
}

parameters.authority = settings.authority;
__block BOOL fBlockHit = NO;
self.acquireSilentButton.enabled = NO;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19150" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19134"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand Down Expand Up @@ -69,10 +69,10 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="788"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="vM0-VN-Vm6">
<rect key="frame" x="0.0" y="0.0" width="414" height="825"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="868"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="QvZ-VB-tXG">
<rect key="frame" x="20" y="20" width="374" height="785"/>
<rect key="frame" x="20" y="20" width="374" height="828"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="oeX-eO-Koe">
<rect key="frame" x="0.0" y="0.0" width="374" height="34"/>
Expand Down Expand Up @@ -355,8 +355,29 @@
</segmentedControl>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="AdE-qt-dtf">
<rect key="frame" x="0.0" y="589" width="374" height="31"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="claims" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hyd-5O-lBr">
<rect key="frame" x="0.0" y="0.0" width="112" height="31"/>
<constraints>
<constraint firstAttribute="width" constant="112" id="jvP-1B-Qgg"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="InO-VA-HKm">
<rect key="frame" x="124" y="0.0" width="250" height="32"/>
<segments>
<segment title="None"/>
<segment title="DeviceId"/>
</segments>
</segmentedControl>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="euI-bP-fOW">
<rect key="frame" x="0.0" y="589" width="374" height="34"/>
<rect key="frame" x="0.0" y="632" width="374" height="34"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tSH-Rx-X2s">
<rect key="frame" x="0.0" y="0.0" width="116.5" height="34"/>
Expand All @@ -382,7 +403,7 @@
</subviews>
</stackView>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="rBo-1H-H5p">
<rect key="frame" x="0.0" y="635" width="374" height="150"/>
<rect key="frame" x="0.0" y="678" width="374" height="150"/>
<constraints>
<constraint firstAttribute="height" constant="150" id="meA-TD-weO"/>
</constraints>
Expand Down Expand Up @@ -488,6 +509,7 @@
<outlet property="acquireSilentButton" destination="B1a-QA-wzK" id="5Sx-IL-YWT"/>
<outlet property="authSchemeSegmentControl" destination="PIA-l0-Kme" id="r4h-be-0gW"/>
<outlet property="authorityButton" destination="VO4-Cz-Zs9" id="c2d-hA-UUm"/>
<outlet property="claimsSegmentedControl" destination="InO-VA-HKm" id="3c7-EU-CFS"/>
<outlet property="customWebviewContainer" destination="Md9-M0-FKl" id="eEx-2S-FNk"/>
<outlet property="customWebviewTypeSegmentControl" destination="iH2-2a-wwo" id="uDh-ew-9ht"/>
<outlet property="extraQueryParamsTextField" destination="N35-g1-oxz" id="5MO-wd-qd4"/>
Expand Down