Skip to content

Commit

Permalink
Add AuthProvider to IAuthSession to hold the AuthProvider used to Aut…
Browse files Browse the repository at this point in the history
…henticate
  • Loading branch information
mythz committed Mar 13, 2017
1 parent a3a44aa commit 67065b1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/ServiceStack/Auth/AuthProvider.cs
Expand Up @@ -140,6 +140,8 @@ protected virtual void SaveUserAuth(IServiceBase authService, IAuthSession sessi

public virtual IHttpResult OnAuthenticated(IServiceBase authService, IAuthSession session, IAuthTokens tokens, Dictionary<string, string> authInfo)
{
session.AuthProvider = Provider;

var userSession = session as AuthUserSession;
if (userSession != null)
{
Expand Down
2 changes: 2 additions & 0 deletions src/ServiceStack/Auth/CredentialsAuthProvider.cs
Expand Up @@ -169,6 +169,8 @@ protected object Authenticate(IServiceBase authService, IAuthSession session, st

public override IHttpResult OnAuthenticated(IServiceBase authService, IAuthSession session, IAuthTokens tokens, Dictionary<string, string> authInfo)
{
session.AuthProvider = Provider;

var userSession = session as AuthUserSession;
if (userSession != null)
{
Expand Down
1 change: 1 addition & 0 deletions src/ServiceStack/Auth/IAuthSession.cs
Expand Up @@ -22,6 +22,7 @@ public interface IAuthSession
List<string> Permissions { get; set; }
bool IsAuthenticated { get; set; }
bool FromToken { get; set; } //Partially restored from JWT
string AuthProvider { get; set; }
string ProfileUrl { get; set; }

//Used for digest authentication replay protection
Expand Down
3 changes: 2 additions & 1 deletion src/ServiceStack/AuthUserSession.cs
Expand Up @@ -55,7 +55,8 @@ public AuthUserSession()
[DataMember(Order = 39)] public virtual string ProfileUrl { get; set; }
[DataMember(Order = 40)] public virtual string Sequence { get; set; }
[DataMember(Order = 41)] public long Tag { get; set; }
[DataMember(Order = 42)] public List<IAuthTokens> ProviderOAuthAccess { get; set; }
[DataMember(Order = 42)] public string AuthProvider { get; set; }
[DataMember(Order = 43)] public List<IAuthTokens> ProviderOAuthAccess { get; set; }

public virtual bool IsAuthorized(string provider)
{
Expand Down

0 comments on commit 67065b1

Please sign in to comment.