Beispiel #1
0
        internal override bool TryRequireSsl(out Identifier secureIdentifier)
        {
            // If this Identifier is already secure, reuse it.
            if (IsDiscoverySecureEndToEnd) {
                secureIdentifier = this;
                return true;
            }

            // If this identifier already uses SSL for initial discovery, return one
            // that guarantees it will be used throughout the discovery process.
            if (String.Equals(Uri.Scheme, Uri.UriSchemeHttps, StringComparison.OrdinalIgnoreCase)) {
                secureIdentifier = new UriIdentifier(this.Uri, true);
                return true;
            }

            // Otherwise, try to make this Identifier secure by normalizing to HTTPS instead of HTTP.
            if (SchemeImplicitlyPrepended) {
                UriBuilder newIdentifierUri = new UriBuilder(this.Uri);
                newIdentifierUri.Scheme = Uri.UriSchemeHttps;
                if (newIdentifierUri.Port == 80) {
                    newIdentifierUri.Port = 443;
                }
                secureIdentifier = new UriIdentifier(newIdentifierUri.Uri, true);
                return true;
            }

            // This identifier is explicitly NOT https, so we cannot change it.
            secureIdentifier = new NoDiscoveryIdentifier(this);
            return false;
        }
Beispiel #2
0
    internal static MockIdentifier GetMockOPIdentifier(Scenarios scenario, UriIdentifier expectedClaimedId, bool useSslOpIdentifier, bool useSslProviderEndpoint)
    {
        var fields = new Dictionary<string, string> {
            { "user", scenario.ToString() },
        };
        Uri opEndpoint = GetFullUrl(DirectedProviderEndpoint, fields, useSslProviderEndpoint);
        Uri opIdentifier = GetOPIdentityUrl(scenario, useSslOpIdentifier);
        ServiceEndpoint se = ServiceEndpoint.CreateForProviderIdentifier(
            opIdentifier,
            opEndpoint,
            new string[] { Protocol.v20.OPIdentifierServiceTypeURI },
            10,
            10
            );

        // Register the Claimed Identifier that directed identity will choose so that RP
        // discovery on that identifier can be mocked up.
        MockHttpRequest.RegisterMockXrdsResponse(expectedClaimedId, se);

        return new MockIdentifier(opIdentifier, new ServiceEndpoint[] { se });
    }
Beispiel #3
0
 public static bool IsValid(string identifier)
 {
     return(XriIdentifier.IsValidXri(identifier) || UriIdentifier.IsValidUri(identifier));
 }
Beispiel #4
0
 internal static MockIdentifier GetMockOPIdentifier(Scenarios scenario, UriIdentifier expectedClaimedId)
 {
     return GetMockOPIdentifier(scenario, expectedClaimedId, false, false);
 }