OAuth OK!
This commit is contained in:
parent
494a840f70
commit
567e4a6635
382 changed files with 52478 additions and 7572 deletions
|
|
@ -5,7 +5,9 @@ using System.Threading.Tasks;
|
|||
using Microsoft.AspNet.Authentication.OAuth;
|
||||
using Microsoft.AspNet.Identity.EntityFramework;
|
||||
using Microsoft.Data.Entity;
|
||||
using Yavsc.Models.Auth;
|
||||
using Yavsc.Models.Booking;
|
||||
using Yavsc.Models.OAuth;
|
||||
|
||||
namespace Yavsc.Models
|
||||
{
|
||||
|
|
@ -26,7 +28,9 @@ namespace Yavsc.Models
|
|||
optionsBuilder.UseNpgsql(Startup.ConnectionString);
|
||||
}
|
||||
|
||||
public DbSet<Application> Applications { get; set; }
|
||||
public DbSet<Client> Applications { get; set; }
|
||||
|
||||
public DbSet<RefreshToken> RefreshTokens { get; set; }
|
||||
/// <summary>
|
||||
/// Activities referenced on this site
|
||||
/// </summary>
|
||||
|
|
@ -151,10 +155,12 @@ namespace Yavsc.Models
|
|||
return Task.FromResult(0);
|
||||
}
|
||||
|
||||
Application FindApplication(string clientId)
|
||||
Client FindApplication(string clientId)
|
||||
{
|
||||
return Applications.FirstOrDefault(
|
||||
app=>app.ApplicationID == clientId);
|
||||
app=>app.Id == clientId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
10
Yavsc/Model/Auth/ApplicationTypes.cs
Normal file
10
Yavsc/Model/Auth/ApplicationTypes.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
|
||||
namespace Yavsc.Models.Auth
|
||||
{
|
||||
public enum ApplicationTypes: int
|
||||
{
|
||||
JavaScript = 0,
|
||||
NativeConfidential = 1
|
||||
};
|
||||
}
|
||||
|
|
@ -1,14 +1,20 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc
|
||||
namespace Yavsc.Models.Auth
|
||||
{
|
||||
public class Application
|
||||
public class Client
|
||||
{
|
||||
[Key]
|
||||
public string ApplicationID { get; set; }
|
||||
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; }
|
||||
|
||||
}
|
||||
}
|
||||
33
Yavsc/Model/Auth/ExternalViewModel.cs
Normal file
33
Yavsc/Model/Auth/ExternalViewModel.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Models
|
||||
namespace Yavsc.Models.OAuth
|
||||
{
|
||||
/// <summary>
|
||||
/// OffLine OAuth2 Token
|
||||
/// To use against the Google Calendar Api
|
||||
/// To use against a third party Api
|
||||
/// </summary>
|
||||
public partial class OAuth2Tokens
|
||||
{
|
||||
|
|
@ -17,7 +17,7 @@ namespace Yavsc.Models
|
|||
public string UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Expiration date & time
|
||||
/// Expiration date & time
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public DateTime Expiration { get; set; }
|
||||
23
Yavsc/Model/Auth/RefreshToken.cs
Normal file
23
Yavsc/Model/Auth/RefreshToken.cs
Normal 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; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,11 @@
|
|||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.Models.Auth {
|
||||
public class Scope {
|
||||
|
||||
|
||||
[Key]
|
||||
|
||||
public string Id { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
|
||||
using Yavsc.Models.OAuth;
|
||||
|
||||
namespace Yavsc.Models.Auth {
|
||||
|
||||
public class UserCredential {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue