Skip to content

Commit

Permalink
Revert "Add method AzureCPConfig.CreateDefaultConfiguration"
Browse files Browse the repository at this point in the history
This reverts commit 548583f.
  • Loading branch information
Yvand committed Jul 10, 2019
1 parent 548583f commit a8c739f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 28 deletions.
24 changes: 3 additions & 21 deletions AzureCP/AzureCPConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -389,35 +389,17 @@ public void ResetClaimTypesList()
TraceSeverity.High, EventSeverity.Information, TraceCategory.Core);
}

/// <summary>
/// If AzureCP is associated with a SPTrustedLoginProvider, create its configuration with default settings and save it into configuration database. If it already exists, it will be replaced.
/// </summary>
/// <returns></returns>
public static AzureCPConfig CreateDefaultConfiguration()
{
SPTrustedLoginProvider spTrust = AzureCP.GetSPTrustAssociatedWithCP(AzureCP._ProviderInternalName);
if (spTrust == null)
{
return null;
}
else
{
return CreateConfiguration(ClaimsProviderConstants.CONFIG_ID, ClaimsProviderConstants.CONFIG_NAME, spTrust.Name);
}
}

/// <summary>
/// Create a persisted object with default configuration of AzureCP.
/// </summary>
/// <param name="persistedObjectID">GUID of the configuration, stored as a persisted object into SharePoint configuration database</param>
/// <param name="persistedObjectName">Name of the configuration, stored as a persisted object into SharePoint configuration database</param>
/// <param name="spTrustName">Name of the SPTrustedLoginProvider that claims provider is associated with</param>
/// <param name="persistedObjectID"></param>
/// <param name="persistedObjectName"></param>
/// <returns></returns>
public static AzureCPConfig CreateConfiguration(string persistedObjectID, string persistedObjectName, string spTrustName)
{
if (String.IsNullOrEmpty(spTrustName))
{
throw new ArgumentNullException("spTrustName");
throw new ArgumentNullException("spTrust");
}

// Ensure it doesn't already exists and delete it if so
Expand Down
19 changes: 12 additions & 7 deletions AzureCP/Features/AzureCP/AzureCP.EventReceiver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,19 @@ private void ExecBaseFeatureActivated(Microsoft.SharePoint.SPFeatureReceiverProp
{
ClaimsProviderLogging svc = ClaimsProviderLogging.Local;
ClaimsProviderLogging.Log($"[{AzureCP._ProviderInternalName}] Activating farm-scoped feature for claims provider \"{AzureCP._ProviderInternalName}\"", TraceSeverity.High, EventSeverity.Information, ClaimsProviderLogging.TraceCategory.Configuration);
AzureCPConfig existingConfig = AzureCPConfig.GetConfiguration(ClaimsProviderConstants.CONFIG_NAME);
if (existingConfig == null)
{
AzureCPConfig.CreateDefaultConfiguration();
}
else

var spTrust = AzureCP.GetSPTrustAssociatedWithCP(AzureCP._ProviderInternalName);
if (spTrust != null)
{
ClaimsProviderLogging.Log($"[{AzureCP._ProviderInternalName}] Use configuration \"{ClaimsProviderConstants.CONFIG_NAME}\" found in the configuration database", TraceSeverity.High, EventSeverity.Information, ClaimsProviderLogging.TraceCategory.Configuration);
AzureCPConfig existingConfig = AzureCPConfig.GetConfiguration(ClaimsProviderConstants.CONFIG_NAME);
if (existingConfig == null)
{
AzureCPConfig.CreateConfiguration(ClaimsProviderConstants.CONFIG_ID, ClaimsProviderConstants.CONFIG_NAME, spTrust.Name);
}
else
{
ClaimsProviderLogging.Log($"[{AzureCP._ProviderInternalName}] Use configuration \"{ClaimsProviderConstants.CONFIG_NAME}\" found in the configuration database", TraceSeverity.High, EventSeverity.Information, ClaimsProviderLogging.TraceCategory.Configuration);
}
}
}
catch (Exception ex)
Expand Down

0 comments on commit a8c739f

Please sign in to comment.