# TrustedServers

#### TrustedServers()
Core/TrustedServers.js 19

A singleton that contains all of the servers that are trusted. Credentials will be sent with any requests to these servers.

##### See:

- Cross-Origin Resource Sharing

### Methods

#### staticCesium.TrustedServers.add(host, port)
Core/TrustedServers.js 32

Adds a trusted server to the registry

Name | Type | Description
--- | --- | ---
`host` | String | The host to be added.
`port` | Number | The port used to access the host.

##### Example:

    // Add a trusted server
    TrustedServers.add('my.server.com', 80);

#### staticCesium.TrustedServers.clear()
Core/TrustedServers.js 148

Clears the registry

##### Example:

    // Remove a trusted server
    TrustedServers.clear();

#### staticCesium.TrustedServers.contains(url) → boolean
Core/TrustedServers.js 127

Tests whether a server is trusted or not. The server must have been added with the port if it is included in the url.

Name | Type | Description
--- | --- | ---
`url` | String | The url to be tested against the trusted list

##### Returns:

Returns true if url is trusted, false otherwise.

##### Example:

    // Add server
    TrustedServers.add('my.server.com', 81);

    // Check if server is trusted
    if (TrustedServers.contains('https://my.server.com:81/path/to/file.png')) {
        // my.server.com:81 is trusted
    }
    if (TrustedServers.contains('https://my.server.com/path/to/file.png')) {
        // my.server.com isn't trusted
    }

#### staticCesium.TrustedServers.remove(host, port)
Core/TrustedServers.js 58

Removes a trusted server from the registry

Name | Type | Description
--- | --- | ---
`host` | String | The host to be removed.
`port` | Number | The port used to access the host.

##### Example:

    // Remove a trusted server
    TrustedServers.remove('my.server.com', 80);