Skip to content

Commit

Permalink
Merge pull request Azure#14 from huangpf/crp2
Browse files Browse the repository at this point in the history
update
  • Loading branch information
AzureRT committed Dec 30, 2014
2 parents e965138 + bbc314f commit 523d1f6
Show file tree
Hide file tree
Showing 397 changed files with 7,204 additions and 624 deletions.
6 changes: 6 additions & 0 deletions src/AzurePowershell.sln
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.StreamAnalytics",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.StreamAnalytics.Test", "ResourceManager\StreamAnalytics\Commands.StreamAnalytics.Test\Commands.StreamAnalytics.Test.csproj", "{7E6683BE-ECFF-4709-89EB-1325E9E70512}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.Extensions", "Common\Azure.Common.Extensions\Common.Extensions.csproj", "{B95C489C-8CB7-4DCF-8D5F-B9AEBDBBAF89}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.NetworkResourceProvider", "ResourceManager\Network\Commands.NetworkResourceProvider\Commands.NetworkResourceProvider.csproj", "{98CFD96B-A6BC-4F15-AE2C-603FC2B58981}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.NetworkResourceProvider.Test", "ResourceManager\Network\Commands.NetworkResourceProvider.Test\Commands.NetworkResourceProvider.Test.csproj", "{A2DF4FE5-46EE-43E2-B246-E5CDDD47B752}"
Expand Down Expand Up @@ -375,6 +377,10 @@ Global
{7E6683BE-ECFF-4709-89EB-1325E9E70512}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E6683BE-ECFF-4709-89EB-1325E9E70512}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E6683BE-ECFF-4709-89EB-1325E9E70512}.Release|Any CPU.Build.0 = Release|Any CPU
{B95C489C-8CB7-4DCF-8D5F-B9AEBDBBAF89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B95C489C-8CB7-4DCF-8D5F-B9AEBDBBAF89}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B95C489C-8CB7-4DCF-8D5F-B9AEBDBBAF89}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B95C489C-8CB7-4DCF-8D5F-B9AEBDBBAF89}.Release|Any CPU.Build.0 = Release|Any CPU
{98CFD96B-A6BC-4F15-AE2C-603FC2B58981}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{98CFD96B-A6BC-4F15-AE2C-603FC2B58981}.Debug|Any CPU.Build.0 = Debug|Any CPU
{98CFD96B-A6BC-4F15-AE2C-603FC2B58981}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

using System;

namespace Microsoft.WindowsAzure.Commands.Utilities.Common.Authentication
namespace Microsoft.Azure.Common.Extensions.Authentication
{
/// <summary>
/// Base class representing an exception that occurs when
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.WindowsAzure;
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;

namespace Microsoft.WindowsAzure.Commands.Utilities.Common.Authentication
namespace Microsoft.Azure.Common.Extensions.Authentication
{
public class AccessTokenCredential : SubscriptionCloudCredentials
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
using System;
using System.Linq;

namespace Microsoft.WindowsAzure.Commands.Utilities.Common.Authentication
namespace Microsoft.Azure.Common.Extensions.Authentication
{
/// <summary>
/// Class storing the configuration information needed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Common.Extensions.Models;
using Microsoft.Azure.Common.Extensions.Properties;
using System;
using System.Security;
using System.Windows.Forms;
using Microsoft.WindowsAzure.Commands.Common.Models;
using Microsoft.WindowsAzure.Commands.Common.Properties;

namespace Microsoft.WindowsAzure.Commands.Utilities.Common.Authentication
namespace Microsoft.Azure.Common.Extensions.Authentication
{
/// <summary>
/// A token provider that uses ADAL to retrieve
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace Microsoft.WindowsAzure.Commands.Utilities.Common.Authentication
namespace Microsoft.Azure.Common.Extensions.Authentication
{
/// <summary>
/// An implementation of <see cref="IWin32Window"/> that gives the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;

namespace Microsoft.WindowsAzure.Commands.Utilities.Common.Authentication
namespace Microsoft.Azure.Common.Extensions.Authentication
{
/// <summary>
/// Class wrapping PInvoke signatures for Windows Credential store
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

using System;

namespace Microsoft.WindowsAzure.Commands.Utilities.Common.Authentication
namespace Microsoft.Azure.Common.Extensions.Authentication
{
public interface IAccessToken
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Common.Extensions.Models;
using System.Security;
using Microsoft.WindowsAzure.Commands.Common.Models;

namespace Microsoft.WindowsAzure.Commands.Utilities.Common.Authentication
namespace Microsoft.Azure.Common.Extensions.Authentication
{
/// <summary>
/// This interface represents objects that can be used
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

namespace Microsoft.WindowsAzure.Commands.Utilities.Common.Authentication
namespace Microsoft.Azure.Common.Extensions.Authentication
{
public enum LoginType
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,20 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.IdentityModel.Clients.ActiveDirectory;
using System;
using System.IO;
using System.Security.Cryptography;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Microsoft.WindowsAzure.Commands.Common;

namespace Microsoft.WindowsAzure.Commands.Utilities.Common.Authentication
namespace Microsoft.Azure.Common.Extensions.Authentication
{
/// <summary>
/// An implementation of the Adal token cache that stores the cache items
/// in the DPAPI-protected file.
/// </summary>
public class ProtectedFileTokenCache : TokenCache
{
private static readonly string CacheFileName = Path.Combine(AzurePowerShell.ProfileDirectory, "TokenCache.dat");
private static readonly string CacheFileName = Path.Combine(AzureSession.ProfileDirectory, AzureSession.TokenCacheFile);

private static readonly object fileLock = new object();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
using System;
using System.Runtime.InteropServices;
using System.Security;
using Microsoft.WindowsAzure.Commands.Utilities.Common.Authentication;
using FILETIME = System.Runtime.InteropServices.ComTypes.FILETIME;

namespace Microsoft.WindowsAzure.Commands.Common.Authentication
namespace Microsoft.Azure.Common.Extensions.Authentication
{
/// <summary>
/// Helper class to store service principal keys and retrieve them
Expand All @@ -27,7 +26,7 @@ namespace Microsoft.WindowsAzure.Commands.Common.Authentication
public static class ServicePrincipalKeyStore
{
private const string keyStoreUserName = "PowerShellServicePrincipalKey";
private const string targetNamePrefix = "AzurePowershell:target=";
private const string targetNamePrefix = "AzureSession:target=";

public static void SaveKey(string appId, string tenantId, SecureString serviceKey)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Common.Extensions.Models;
using Microsoft.Azure.Common.Extensions.Properties;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using System;
using System.Collections.Generic;
using System.Security;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Microsoft.WindowsAzure.Commands.Common.Authentication;
using Microsoft.WindowsAzure.Commands.Common.Models;
using Microsoft.WindowsAzure.Commands.Common.Properties;

namespace Microsoft.WindowsAzure.Commands.Utilities.Common.Authentication
namespace Microsoft.Azure.Common.Extensions.Authentication
{
internal class ServicePrincipalTokenProvider : ITokenProvider
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

namespace Microsoft.WindowsAzure.Commands.Utilities.Common.Authentication
namespace Microsoft.Azure.Common.Extensions.Authentication
{
public enum ShowDialog
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Common.Extensions.Models;
using Microsoft.Azure.Common.Extensions.Properties;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using System;
using System.Runtime.InteropServices;
using System.Security;
using System.Threading;
using System.Windows.Forms;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Microsoft.WindowsAzure.Commands.Common.Models;
using Microsoft.WindowsAzure.Commands.Common.Properties;

namespace Microsoft.WindowsAzure.Commands.Utilities.Common.Authentication
namespace Microsoft.Azure.Common.Extensions.Authentication
{
/// <summary>
/// A token provider that uses ADAL to retrieve
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,32 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Common.Extensions.Factories;
using Microsoft.Azure.Common.Extensions.Models;
using Microsoft.Azure.Common.Extensions.Properties;
using System;
using System.Collections.Generic;
using Microsoft.WindowsAzure.Commands.Common.Common;
using Microsoft.WindowsAzure.Commands.Common.Factories;
using Microsoft.WindowsAzure.Commands.Common.Models;
using Microsoft.WindowsAzure.Commands.Common.Properties;
using Microsoft.WindowsAzure.Commands.Utilities.Common;
using Microsoft.WindowsAzure.Commands.Utilities.Common.Authentication;

namespace Microsoft.WindowsAzure.Commands.Common
using System.IO;

namespace Microsoft.Azure.Common.Extensions
{
public static class AzureSession
{
static AzureSession()
{
ClientFactory = new AzurePowerShellClientFactory();
ClientFactory = new ClientFactory();
AuthenticationFactory = new AuthenticationFactory();
CurrentContext = new AzureContext();
CurrentContext.Environment = AzureEnvironment.PublicEnvironments[EnvironmentName.AzureCloud];
AzureSession.OldProfileFile = "WindowsAzureProfile.xml";
AzureSession.OldProfileFileBackup = "WindowsAzureProfile.xml.bak";
AzureSession.ProfileDirectory = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
Resources.AzureDirectoryName); ;
AzureSession.ProfileFile = "AzureProfile.json";
AzureSession.TokenCacheFile = "TokenCache.dat";
}

public static AzureContext CurrentContext {get; private set; }
public static AzureContext CurrentContext { get; private set; }

public static void SetCurrentContext(AzureSubscription subscription, AzureEnvironment environment, AzureAccount account)
{
Expand Down Expand Up @@ -89,5 +93,15 @@ public static void SetCurrentContext(AzureSubscription subscription, AzureEnviro
public static IClientFactory ClientFactory { get; set; }

public static IAuthenticationFactory AuthenticationFactory { get; set; }

public static string ProfileDirectory { get; set; }

public static string TokenCacheFile { get; set; }

public static string ProfileFile { get; set; }

public static string OldProfileFileBackup { get; set; }

public static string OldProfileFile { get; set; }
}
}
Loading

0 comments on commit 523d1f6

Please sign in to comment.