Re-fabrication

This commit is contained in:
2018-03-26 19:27:29 +02:00
parent e00bcbe275
commit 8fbe56c67e
499 changed files with 7510 additions and 12466 deletions

View File

@ -0,0 +1,10 @@
namespace Yavsc.Models.Auth
{
public enum ApplicationTypes: int
{
JavaScript = 0,
NativeConfidential = 1
};
}

View File

@ -0,0 +1,20 @@
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Models.Auth
{
public class Client
{
[Key]
public string Id { get; set; }
public string DisplayName { get; set; }
public string RedirectUri { get; set; }
[MaxLength(100)]
public string LogoutRedirectUri { get; set; }
public string Secret { get; set; }
public ApplicationTypes Type { get; set; }
public bool Active { get; set; }
public int RefreshTokenLifeTime { get; set; }
}
}

View File

@ -0,0 +1,33 @@
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Models.Auth {
public class ExternalLoginViewModel
{
public string Name { get; set; }
public string Url { get; set; }
public string State { get; set; }
}
public class RegisterExternalBindingModel
{
[Required]
public string UserName { get; set; }
[Required]
public string Provider { get; set; }
[Required]
public string ExternalAccessToken { get; set; }
}
public class ParsedExternalAccessToken
{
public string user_id { get; set; }
public string app_id { get; set; }
}
}

View File

@ -0,0 +1,48 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Models.OAuth
{
/// <summary>
/// OffLine OAuth2 Token
/// To use against a third party Api
/// </summary>
public partial class OAuth2Tokens
{
/// <summary>
/// Unique identifier, equals the user email from OAuth provider
/// </summary>
/// <returns></returns>
[Key]
public string UserId { get; set; }
/// <summary>
/// Expiration date &amp; time
/// </summary>
/// <returns></returns>
public DateTime Expiration { get; set; }
/// <summary>
/// Expiration time span in seconds
/// </summary>
/// <returns></returns>
public string ExpiresIn { get; set; }
/// <summary>
/// Should always be <c>Bearer</c> ...
/// </summary>
/// <returns></returns>
public string TokenType { get; set; }
/// <summary>
/// The Access Token!
/// </summary>
/// <returns></returns>
public string AccessToken { get; set; }
/// <summary>
/// The refresh token
/// </summary>
/// <returns></returns>
public string RefreshToken { get; set; }
}
}

View File

@ -0,0 +1,23 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Models.Auth
{
public class RefreshToken
{
[Key]
public string Id { get; set; }
[Required]
[MaxLength(50)]
public string Subject { get; set; }
[Required]
[MaxLength(50)]
public string ClientId { get; set; }
public DateTime IssuedUtc { get; set; }
public DateTime ExpiresUtc { get; set; }
[Required]
public string ProtectedTicket { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Models.Auth {
public class Scope {
[Key]
public string Id { get; set; }
public string Description { get; set; }
}
}

View File

@ -0,0 +1,22 @@
using Yavsc.Models.OAuth;
namespace Yavsc.Models.Auth {
public class UserCredential {
public string UserId { get; set; }
public OAuth2Tokens Tokens { get; set; }
public UserCredential(string userId, OAuth2Tokens tokens)
{
UserId = userId;
Tokens = tokens;
}
public string GetHeader()
{
return Tokens.TokenType+" "+Tokens.AccessToken;
}
}
}