using System; using System.Runtime.Serialization; namespace GitHub.DistributedTask.WebApi { /// /// Provides data necessary for authorizing the agent using OAuth 2.0 authentication flows. /// [DataContract] public sealed class TaskAgentAuthorization { /// /// Initializes a new TaskAgentAuthorization instance with default values. /// public TaskAgentAuthorization() { } private TaskAgentAuthorization(TaskAgentAuthorization objectToBeCloned) { this.AuthorizationUrl = objectToBeCloned.AuthorizationUrl; this.ClientId = objectToBeCloned.ClientId; if (objectToBeCloned.PublicKey != null) { this.PublicKey = objectToBeCloned.PublicKey.Clone(); } } /// /// Endpoint used to obtain access tokens from the configured token service. /// [DataMember(EmitDefaultValue = false)] public Uri AuthorizationUrl { get; set; } /// /// Client identifier for this agent. /// [DataMember(EmitDefaultValue = false)] public Guid ClientId { get; set; } /// /// Public key used to verify the identity of this agent. /// [DataMember(EmitDefaultValue = false)] public TaskAgentPublicKey PublicKey { get; set; } /// /// Creates a deep copy of the authorization data. /// /// A new TaskAgentAuthorization instance copied from the current instance public TaskAgentAuthorization Clone() { return new TaskAgentAuthorization(this); } } }