//--------------------------------------------------------------------------------------------------------------------- public OpenIdRelyingParty GetRelyingParty(string input) { bool useOpenIdProviderIdentifier = (EndpointUrl != null || OpenIdProviderIdentifier != null); string identifier = input; if (!useOpenIdProviderIdentifier && identifier != null) { if (!Regex.IsMatch(identifier, "^[a-z]+://.+")) { identifier = "http://" + identifier; } // Add trailing slash if normalized identifier has no identifier component if (Regex.IsMatch(identifier, "^[a-z]+://[^/]+$")) { identifier += "/"; } if (ConversionPattern != null) { if (Regex.Match(ConversionPattern, "[a-z]+://[^/]+$").Success) { ConversionPattern += "/"; } int before = ConversionPattern.IndexOf('*'); // number of characters before asterisk bool matches = true; if (before == -1) { matches = false; } else { int after = ConversionPattern.Length - before - 1; // number of characters after asterisk if ( identifier.Length < ConversionPattern.Length || identifier.Substring(0, before) != ConversionPattern.Substring(0, before) || identifier.Substring(identifier.Length - after) != ConversionPattern.Substring(ConversionPattern.Length - after) ) { matches = false; } } if (!matches) { identifier = ConversionPattern.Replace("*", input); } } } return(new OpenIdRelyingParty( useOpenIdProviderIdentifier, useOpenIdProviderIdentifier ? OpenIdProviderIdentifier : identifier, EndpointUrl )); }