Inheritance: Serializable
Beispiel #1
0
    /**
     * Constructor that provides compatibility with old trustType and followRefs interface
     */
    public ResolverFlags(TrustType trustType, bool followRefs)
    {
    	this();
		setHttps(trustType.isHTTPS());
		setSaml(trustType.isSAML());
		setRefs(followRefs);
    }
        /**
        * Constructs a new Proxy Resolution endpoint.
        * @param resolvers - The Uri(s) where the proxy is implemented.
        * @param providerID - The global i-number of the I-Broker providing this Proxy Resolution Service.
        * @param trustType - The Trust Type supported by the proxy
        * @param refs - Whether the proxy supports following references
        * @param sep - Whether the proxy supports service endpoint selection
        */
        public ProxyResolutionService(Uri[] proxies, string providerID, TrustType trustType, bool? refs, bool? sep)
        {
            /*
            * The ProviderID of a Proxy Resolution Service is OPTIONAL.
            */
            if (providerID != null) this.setProviderId(providerID);

            /*
            * This setting is REQUIRED.
            */
            this.addType(new SEPType(SERVICE_TYPE, null, true));

            /*
            * This setting is REQUIRED.
            */

            for (int i = 0; i < SERVICE_MEDIA_TYPES.Length; i++) {

            string mediaType = SERVICE_MEDIA_TYPES[i];

            if (trustType != null && !trustType.Equals(TrustType.TRUST_NONE)) {

                mediaType += TRUST_TYPE_SEPARATOR + trustType.getParameterPair();
                if (refs != null) mediaType += REFS_SEPARATOR + refs;
                if (sep != null) mediaType += SEP_SEPARATOR + sep;
            }

            this.addMediaType(new SEPMediaType(mediaType, null, false));
            }

            /*
            * These are the URIs where the Proxy Resolution Service is implemented.
            */
            for (int i = 0; i < proxies.Length; i++) {

            Uri resolver = proxies[i];

            try {

                int? priority = resolver.Scheme.Equals("https", StringComparison.OrdinalIgnoreCase) ?
                    URI_PRIORITY_HTTPS : URI_PRIORITY_DEFAULT;

                this.addURI(new SEPUri(resolver.ToString(), priority, SEPUri.APPEND_NONE));
            } catch (UriFormatException) {

                continue;
            }
            }
        }
        /**
        * Constructs a new Authority Resolution 2.0 endpoint.
        * @param resolvers - The Uri(s) where the authority will be resolved.
        * @param providerID - The global i-number of the I-Broker providing this Authority Resolution Service.
        * @param append - The append attribute to use for the URIs.
        */
        public AuthorityResolutionService(Uri[] resolvers, string providerID, TrustType trustType, string append)
        {
            if (append == null) append = SEPUri.APPEND_NONE;

            /*
            * The ProviderID of an untrusted Authority Resolution Service is OPTIONAL, otherwise REQUIRED.
            */
            if (providerID != null) this.setProviderId(providerID);

            /*
            * This setting is REQUIRED.
            */
            this.addType(new SEPType(SERVICE_TYPE, null, true));

            /*
            * This setting is REQUIRED.
            */

            string mediaType = SERVICE_MEDIA_TYPE;
            if (trustType != null && !trustType.Equals(TrustType.TRUST_NONE)) {

                mediaType += TRUST_TYPE_SEPARATOR + trustType.getParameterPair();
            }

            this.addMediaType(new SEPMediaType(mediaType, null, false));

            /*
            * These are the URIs where the Authority Resolution Service is implemented.
            */
            for (int i = 0; i < resolvers.Length; i++) {

                Uri resolver = resolvers[i];

                try {

                    int? priority = resolver.Scheme.Equals("https", StringComparison.OrdinalIgnoreCase) ?
                            URI_PRIORITY_HTTPS : URI_PRIORITY_DEFAULT;

                    this.addURI(new SEPUri(resolver.ToString(), priority, append));
                } catch (UriFormatException) {

                    continue;
                }
            }
        }
Beispiel #4
0
        public static XRD createAuthRoot(string uri)
        {
            XRD xrd = new XRD();

            // construct an authority resolution service
            Service srv = new Service();
            TrustType tt = new TrustType(); // default trust type
            string authMediaType = Tags.CONTENT_TYPE_XRDS + ";"
                + tt.getParameterPair();
            srv.addMediaType(authMediaType, null, false);
            srv.addType(Tags.SERVICE_AUTH_RES);
            srv.addURI(uri);

            // add it to the XRD
            xrd.addService(srv);

            return xrd;
        }
 public AuthorityResolutionService(Uri resolver, string providerId, TrustType trustType)
     : this(new Uri[] { resolver }, providerId, trustType, null)
 {
 }
 public AuthorityResolutionService(Uri[] resolvers, string providerId, TrustType trustType)
     : this(resolvers, providerId, trustType, null)
 {
 }
 public ProxyResolutionService(Uri[] proxies, string providerId, TrustType trustType)
     : this(proxies, providerId, trustType, null, null)
 {
 }
 public ProxyResolutionService(Uri proxy, string providerId, TrustType trustType, bool? refs, bool? sep)
     : this(new Uri[] { proxy }, providerId, trustType, refs, sep)
 {
 }
 public ProxyResolutionService(Uri proxy, string providerId, TrustType trustType)
     : this(new Uri[] { proxy }, providerId, trustType, null, null)
 {
 }