Skip to content
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
1 change: 0 additions & 1 deletion dot-net/MSAL.Desktop/MSAL.Desktop/MSAL.Desktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="PublicClientApplicationExtensions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
Expand Down

This file was deleted.

47 changes: 46 additions & 1 deletion dot-net/MSAL/AuthenticationResult.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,57 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace MSAL
{
public class AuthenticationResult
{
{ /// <summary>
/// Gets the type of the Access Token returned.
/// </summary>
[DataMember]
public string AccessTokenType { get; private set; }

/// <summary>
/// Gets the Access Token requested.
/// </summary>
[DataMember]
public string AccessToken { get; internal set; }

/// <summary>
/// Gets the point in time in which the Access Token returned in the AccessToken property ceases to be valid.
/// This value is calculated based on current UTC time measured locally and the value expiresIn received from the service.
/// </summary>
[DataMember]
public DateTimeOffset ExpiresOn { get; internal set; }

/// <summary>
/// Gets an identifier for the tenant the token was acquired from. This property will be null if tenant information is not returned by the service.
/// </summary>
[DataMember]
public string TenantId { get; private set; }

/// <summary>
/// Gets user information including user Id. Some elements in UserInfo might be null if not returned by the service.
/// </summary>
[DataMember]
public UserInfo UserInfo { get; internal set; }

/// <summary>
/// Gets the entire Id Token if returned by the service or null if no Id Token is returned.
/// </summary>
[DataMember]
public string IdToken { get; internal set; }

/// <summary>
/// Creates authorization header from authentication result.
/// </summary>
/// <returns>Created authorization header</returns>
public string CreateAuthorizationHeader()
{
return null;
}
}
}
3 changes: 3 additions & 0 deletions dot-net/MSAL/MSAL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@
<Compile Include="PublicClientApplication.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TokenCache.cs" />
<Compile Include="TokenCacheItem.cs" />
<Compile Include="TokenCacheNotificationArgs.cs" />
<Compile Include="User.cs" />
<Compile Include="UserAssertion.cs" />
<Compile Include="UserIdentifier.cs" />
<Compile Include="UserInfo.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="System">
Expand Down
18 changes: 9 additions & 9 deletions dot-net/MSAL/MSAL.sln
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24606.1
VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MSAL", "MSAL.csproj", "{1701419C-E568-4E3B-A135-9C1BA1A7E858}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleNativeClientApp", "..\SampleNativeClientApp\SampleNativeClientApp.csproj", "{8619394D-05E6-4522-9A92-F4C01D4F73B7}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MSAL.Desktop", "..\MSAL.Desktop\MSAL.Desktop\MSAL.Desktop.csproj", "{0279CA8A-A26A-49B1-88F1-6ADE9821066E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SampleApps", "SampleApps", "{5CFC26E1-4CA2-4281-AB20-AE740FCC50A2}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SampleApps", "SampleApps", "{2212DD02-0D89-4074-AAED-5B1CC2165EC9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MSAL.Desktop", "..\MSAL.Desktop\MSAL.Desktop\MSAL.Desktop.csproj", "{0279CA8A-A26A-49B1-88F1-6ADE9821066E}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApplication", "..\sampleApps\ConsoleApplication\ConsoleApplication.csproj", "{FEE02A9F-E999-4D5E-9FE8-8D352EAC08CD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -21,19 +21,19 @@ Global
{1701419C-E568-4E3B-A135-9C1BA1A7E858}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1701419C-E568-4E3B-A135-9C1BA1A7E858}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1701419C-E568-4E3B-A135-9C1BA1A7E858}.Release|Any CPU.Build.0 = Release|Any CPU
{8619394D-05E6-4522-9A92-F4C01D4F73B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8619394D-05E6-4522-9A92-F4C01D4F73B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8619394D-05E6-4522-9A92-F4C01D4F73B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8619394D-05E6-4522-9A92-F4C01D4F73B7}.Release|Any CPU.Build.0 = Release|Any CPU
{0279CA8A-A26A-49B1-88F1-6ADE9821066E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0279CA8A-A26A-49B1-88F1-6ADE9821066E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0279CA8A-A26A-49B1-88F1-6ADE9821066E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0279CA8A-A26A-49B1-88F1-6ADE9821066E}.Release|Any CPU.Build.0 = Release|Any CPU
{FEE02A9F-E999-4D5E-9FE8-8D352EAC08CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FEE02A9F-E999-4D5E-9FE8-8D352EAC08CD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FEE02A9F-E999-4D5E-9FE8-8D352EAC08CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FEE02A9F-E999-4D5E-9FE8-8D352EAC08CD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{8619394D-05E6-4522-9A92-F4C01D4F73B7} = {5CFC26E1-4CA2-4281-AB20-AE740FCC50A2}
{FEE02A9F-E999-4D5E-9FE8-8D352EAC08CD} = {2212DD02-0D89-4074-AAED-5B1CC2165EC9}
EndGlobalSection
EndGlobal
150 changes: 130 additions & 20 deletions dot-net/MSAL/PublicClientApplication.cs
Original file line number Diff line number Diff line change
@@ -1,78 +1,188 @@
using System.Threading.Tasks;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace MSAL
{
/// <summary>
/// Native applications (desktop/phone/iOS/Android).
/// </summary>
public class PublicClientApplication
{
//TODO it would be nice to have a uber constructor just match API footprint with other platforms.
// Other platforms do not have syntatic sugar like
// new Instance(value){
// Property = prop
// }
// It would be more developer friendly to have a constructor instead.
// what about validateAuthority? Do we really need it?


/// <summary>
/// Default consutructor of the application. It is here to emphasise the lack of parameters.
/// </summary>
public PublicClientApplication()
{
}

//consider this for other platforms
/* public PublicClientApplication(string clientId, string redirectUri, TokenCache tokenCache)
{
this.ClientId = clientId;
this.RedirectUri = redirectUri;
this.TokenCache = tokenCache;
}*/
//TODO: consider this for other platforms
/// <summary>
/// TODO it would be nice to have a uber constructor just match API footprint with other platforms.
/// Other platforms do not have syntatic sugar like
/// new Instance(value){
/// Property = prop
/// }
/// It would be more developer friendly to have a constructor instead.
/// </summary>
/// <param name="clientId"></param>
/// <param name="redirectUri"></param>
public PublicClientApplication(string clientId, string redirectUri)
{
this.ClientId = clientId;
this.RedirectUri = redirectUri;
}


//default is true
public bool ValidateAuthority { get; set; }


/// <summary>
/// Will be a default value. Can be overriden by the developer.
/// </summary>
public string ClientId { get; set; }


/// <summary>
/// Redirect Uri configured in the portal. Will have a default value. Not required, if the developer is using the default client ID.
/// </summary>
public string RedirectUri { get; set; }

/// <summary>
/// .NET specific property that allows configuration of platform specific properties. For example, in iOS/Android it woul include the flag to enable/disable broker.
/// </summary>
public IPlatformParameters PlatformParameters { get; set; }

/// <summary>
/// default false
/// </summary>
public string RestrictToSingleUser { get; set; }

//how to efficiently tell people to set only scheme://hostname/tenant/ part as the authority?
/// <summary>
/// Default will point to login.microsoftonline.com/common. Developer will be able to point to other instances like china/fairfax/blackforest.
/// </summary>
public string DefaultAuthority { get; set; }

/// <summary>
/// Default cache will be
/// </summary>
public TokenCache TokenCache { get; set; }

/// <summary>
/// Returns a User centric view over the cache that provides a list of all the signed in users.
/// </summary>
public IEnumerable<User> Users { get; }

//TODO look into adding user identifier when domain cannot be queried or privacy settings are against you
/// <summary>
/// .NET specific method for intergrated auth. To support Xamarin, we would need to move these to platform specific libraries.
/// </summary>
/// <param name="scope"></param>
/// <returns></returns>
public async Task<AuthenticationResult> AcquireTokenWithIntegratedAuthAsync(string[] scope)
{
return null;
}

/// <summary>
/// .NET specific method for intergrated auth. To support Xamarin, we would need to move these to platform specific libraries.
/// </summary>
/// <param name="scope"></param>
/// <param name="authority"></param>
/// <returns></returns>
public async Task<AuthenticationResult> AcquireTokenWithIntegratedAuthAsync(string[] scope, string authority)
{
return null;
}

/// <summary>
///
/// </summary>
/// <param name="scope"></param>
/// <returns></returns>
public async Task<AuthenticationResult> AcquireTokenSilentAsync(string[] scope)
{
return null;
}

/// <summary>
///
/// </summary>
/// <param name="scope"></param>
/// <param name="userId"></param>
/// <returns></returns>
public async Task<AuthenticationResult> AcquireTokenSilentAsync(string[] scope, UserIdentifier userId)
{
return null;
}

//Iplatformparameter is required for android.

/// <summary>
///
/// </summary>
/// <param name="scope"></param>
/// <param name="userId"></param>
/// <param name="authority"></param>
/// <returns></returns>
public async Task<AuthenticationResult> AcquireTokenSilentAsync(string[] scope, UserIdentifier userId,
string authority)
{
return null;
}

//what about device code methods?
//TODO we should look at them later.
/// <summary>
///
/// </summary>
/// <param name="scope"></param>
/// <returns></returns>
public async Task<AuthenticationResult> AcquireTokenAsync(string[] scope)
{
return null;
}

/// <summary>
///
/// </summary>
/// <param name="scope"></param>
/// <param name="userId"></param>
/// <returns></returns>
public async Task<AuthenticationResult> AcquireTokenAsync(string[] scope, UserIdentifier userId)
{
return null;
}

/// <summary>
///
/// </summary>
/// <param name="scope"></param>
/// <param name="userId"></param>
/// <param name="extraQueryParameters"></param>
/// <returns></returns>
public async Task<AuthenticationResult> AcquireTokenAsync(string[] scope, UserIdentifier userId,
string extraQueryParameters)
{
return null;
}

/// <summary>
///
/// </summary>
/// <param name="scope"></param>
/// <param name="userId"></param>
/// <param name="extraQueryParameters"></param>
/// <param name="additionalScope"></param>
/// <param name="authority"></param>
/// <returns></returns>
public async Task<AuthenticationResult> AcquireTokenAsync(string[] scope, UserIdentifier userId,
string extraQueryParameters, string[] additionalScope, string authority)
{
return null;
}

//what about device code methods?
//TODO we should look at them later.

}
}
Loading