mirror of
https://github.com/Sarsoo/IF.Lastfm.git
synced 2024-10-17 07:13:09 +01:00
Allow loading an existing session into an IAuth (create a UserSession, pass it in)
This commit is contained in:
parent
6ee13480cc
commit
6b98c368a9
@ -30,6 +30,17 @@ public Auth(string apikey, string secret)
|
|||||||
_apiSecret = secret;
|
_apiSecret = secret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Load an existing user session
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="session">Session to load</param>
|
||||||
|
/// <returns>Whether session object is valid</returns>
|
||||||
|
public bool LoadSession(UserSession session)
|
||||||
|
{
|
||||||
|
User = session;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<LastResponse> GetSessionTokenAsync(string username, string password)
|
public async Task<LastResponse> GetSessionTokenAsync(string username, string password)
|
||||||
{
|
{
|
||||||
const string apiMethod = "auth.getMobileSession";
|
const string apiMethod = "auth.getMobileSession";
|
||||||
|
@ -11,6 +11,13 @@ public interface IAuth
|
|||||||
string ApiKey { get; }
|
string ApiKey { get; }
|
||||||
UserSession User { get; }
|
UserSession User { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Load an existing user session object.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="session"></param>
|
||||||
|
/// <returns>Whether session object is valid</returns>
|
||||||
|
bool LoadSession(UserSession session);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the session token which is used as authentication for any service calls.
|
/// Gets the session token which is used as authentication for any service calls.
|
||||||
/// Username and password aren't stored.
|
/// Username and password aren't stored.
|
||||||
|
Loading…
Reference in New Issue
Block a user