yavsc/src/cli/Settings/ConnectionSettings.cs

45 lines
1.4 KiB
C#
Raw Normal View History

2018-07-26 17:10:57 +02:00
namespace cli
{
using System.ComponentModel.DataAnnotations.Schema;
2019-06-25 02:58:35 +01:00
using System.Runtime.Serialization;
2018-07-26 17:10:57 +02:00
using Newtonsoft.Json;
public class ConnectionSettings
{
2018-08-05 04:16:21 +02:00
public string ClientId { get; set; }
public string ClientSecret { get; set; }
public string Authority { get; set; }
public string Audience { get; set; }
2018-07-26 17:10:57 +02:00
public string SiteAccessSheme { get; set; } = "http";
2019-06-25 02:58:35 +01:00
public int Port { get; set; }
2018-07-26 17:10:57 +02:00
public string Scope { get; set; } = "profile";
[NotMapped]
[JsonIgnore]
public string AuthorizeUrl {get {
2019-06-25 02:58:35 +01:00
return Port==0 ? $"{SiteAccessSheme}://{Authority}/authorize" :
$"{SiteAccessSheme}://{Authority}:{Port}/authorize" ;
2018-07-26 17:10:57 +02:00
} }
[NotMapped]
[JsonIgnore]
public string RedirectUrl {get {
2019-06-25 02:58:35 +01:00
return Port==0 ? $"{SiteAccessSheme}://{Authority}/oauth/success" :
$"{SiteAccessSheme}://{Authority}:{Port}/oauth/success" ;
2018-07-26 17:10:57 +02:00
} }
[NotMapped]
[JsonIgnore]
2019-06-25 02:58:35 +01:00
public string AccessTokenUrl { get {
return Port==0 ? $"{SiteAccessSheme}://{Authority}/token":
$"{SiteAccessSheme}://{Authority}:{Port}/token";
} }
[NotMapped]
[JsonIgnore]
public string StreamingUrl { get {
return Port==0 ? $"{SiteAccessSheme}://{Authority}/ws":
$"{SiteAccessSheme}://{Authority}:{Port}/ws";
2018-07-26 17:10:57 +02:00
} }
}
}