Created
July 22, 2012 01:48
-
-
Save sandrinodimattia/3157896 to your computer and use it in GitHub Desktop.
Configure MaxClockSkew
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Set the maximum difference in minutes | |
int maxDifference = 300; | |
// Create a custom binding based on an existing binding | |
CustomBinding myCustomBinding = new CustomBinding(currentBinding); | |
// Set the maxClockSkew | |
var security = myCustomBinding.Elements.Find<SymmetricSecurityBindingElement>(); | |
security.LocalClientSettings.MaxClockSkew = TimeSpan.FromMinutes(maxDifference); | |
security.LocalServiceSettings.MaxClockSkew = TimeSpan.FromMinutes(maxDifference); | |
// Set the maxClockSkew | |
var secureTokenParams = (SecureConversationSecurityTokenParameters)security.ProtectionTokenParameters; | |
var bootstrap = secureTokenParams.BootstrapSecurityBindingElement; | |
bootstrap.LocalClientSettings.MaxClockSkew = TimeSpan.FromMinutes(maxDifference); | |
bootstrap.LocalServiceSettings.MaxClockSkew = TimeSpan.FromMinutes(maxDifference); | |
// Update the binding of the endpoint | |
service.Description.Endpoints[0].Binding = myCustomBinding; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment