yavsc/src/cli/Settings/ConnectionSettings.cs

48 lines
1.5 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;
2019-06-25 17:11:16 +01:00
using Yavsc;
2018-07-26 17:10:57 +02:00
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; }
2026-07-12 01:17:52 +01:00
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
} }
2026-07-12 01:17:52 +01:00
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
} }
2026-07-12 01:17:52 +01:00
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]
2020-12-29 19:42:37 +00:00
public string StreamingUrl { get {
2026-05-30 19:34:22 +01:00
return Port==0 ? $"ws://{Authority}"+YavscConstants.StreamingPath:
$"ws://{Authority}:{Port}"+YavscConstants.StreamingPath;
} }
2018-07-26 17:10:57 +02:00
}
2020-10-18 23:00:17 +01:00
}