public async Task Callback(SignInCallback callback) { using (var request = new HttpRequestMessage(HttpMethod.Post, $"/api/v1/contacts/callback")) { await PostPutRequest(request, callback); } }
public async Task <ActionResult> Callback([FromBody] SignInCallback callback) { _logger.LogInformation($"Received callback from ASLogin: Sub: {callback.Sub} SourceId: {callback.SourceId}"); await _mediator.Send(new UpdateSignInIdRequest(Guid.Parse(callback.Sub), Guid.Parse(callback.SourceId))); return(Ok()); }
/// <summary> /// Sends a request to server, to log in as a guest /// </summary> public void SignInAsGuest(SignInCallback callback, IClientSocket connection) { SignIn(new Dictionary <string, string>() { { "guest", string.Empty } }, callback, connection); }
/// <summary> /// Sends a login request, using given token /// </summary> public void SignInWithToken(string token, SignInCallback callback, IClientSocket connection) { var credentials = new MstProperties(); credentials.Add(MstDictKeys.USER_AUTH_TOKEN, token); SignIn(credentials, callback, connection); }
/// <summary> /// Sends a login request, using given token /// </summary> public void SignIn(string token, SignInCallback callback, IClientSocket connection) { var credentials = new MstProperties(); credentials.Add("token", token); SignIn(credentials, callback, connection); }
/// <summary> /// Sends a login request, using given credentials /// </summary> public void SignInWithEmail(string email, SignInCallback callback, IClientSocket connection) { var credentials = new MstProperties(); credentials.Add(MstDictKeys.USER_EMAIL, email); SignIn(credentials, callback, connection); }
/// <summary> /// Sends a request to server, to log in as a guest /// </summary> public void SignInAsGuest(SignInCallback callback, IClientSocket connection) { var credentials = new MstProperties(); credentials.Add("guest", string.Empty); SignIn(credentials, callback, connection); }
/// <summary> /// Sends a login request, using given credentials /// </summary> public void SignInWithPhoneNumber(string phoneNumber, SignInCallback callback, IClientSocket connection) { var credentials = new MstProperties(); credentials.Add(MstDictKeys.USER_PHONE_NUMBER, phoneNumber); SignIn(credentials, callback, connection); }
/// <summary> /// Sends a login request, using given credentials /// </summary> public void SignIn(string username, string password, SignInCallback callback, IClientSocket connection) { SignIn(new Dictionary <string, string> { { "username", username }, { "password", password } }, callback, connection); }
/// <summary> /// Sends a request to server, to log in as a guest /// </summary> /// <param name="callback"></param> public void SignInAsGuest(SignInCallback callback) { Logs.Debug("Signing in as Guest..."); SignIn(new Dictionary <string, string>() { { "guest", string.Empty } }, callback, Connection); }
/// <summary> /// Sends a login request, using given credentials /// </summary> public void SignInWithLoginAndPassword(string username, string password, SignInCallback callback, IClientSocket connection) { var credentials = new MstProperties(); credentials.Add(MstDictKeys.USER_NAME, username); credentials.Add(MstDictKeys.USER_PASSWORD, password); SignIn(credentials, callback, connection); }
/// <summary> /// Sends a login request, using given credentials /// </summary> public void SignIn(string username, string password, SignInCallback callback, IClientSocket connection) { var credentials = new MstProperties(); credentials.Add(MstDictKeys.userName, username); credentials.Add(MstDictKeys.userPassword, password); SignIn(credentials, callback, connection); }
/// <summary> /// Sends a request to server, to log in with auth token /// </summary> /// <param name="callback"></param> public void SignInWithToken(SignInCallback callback) { if (!HasAuthToken()) { throw new Exception("You have no auth token!"); } SignIn(PlayerPrefs.GetString(AuthTokenKey()), callback); }
/// <summary> /// Sends a request to server, to log in with auth token /// </summary> /// <param name="callback"></param> /// <param name="connection"></param> public void SignInWithToken(SignInCallback callback, IClientSocket connection) { if (!HasAuthToken()) { throw new Exception("You have no auth token!"); } SignInWithToken(PlayerPrefs.GetString(MstDictKeys.USER_AUTH_TOKEN), callback, connection); }
/// <summary> /// Sends a login request, using given credentials /// </summary> public void SignIn(string username, string password, SignInCallback callback, IClientSocket connection) { var credentials = new DictionaryOptions(); credentials.Add("username", username); credentials.Add("password", password); SignIn(credentials, callback, connection); }
/// <summary> /// Sends a generic login request /// </summary> public void SignIn(MstProperties data, SignInCallback callback, IClientSocket connection) { Logs.Debug("Signing in..."); if (!connection.IsConnected) { callback.Invoke(null, "Not connected to server"); return; } IsNowSigningIn = true; // We first need to get an aes key // so that we can encrypt our login data Mst.Security.GetAesKey(aesKey => { if (aesKey == null) { IsNowSigningIn = false; callback.Invoke(null, "Failed to log in due to security issues"); return; } var encryptedData = Mst.Security.EncryptAES(data.ToBytes(), aesKey); connection.SendMessage((short)MstMessageCodes.SignInRequest, encryptedData, (status, response) => { IsNowSigningIn = false; if (status != ResponseStatus.Success) { ClearAuthToken(); callback.Invoke(null, response.AsString("Unknown error")); return; } AccountInfo = response.Deserialize(new AccountInfoPacket()); IsSignedIn = true; if (RememberMe) { SaveAuthToken(AccountInfo.Token); } else { ClearAuthToken(); } callback.Invoke(AccountInfo, null); OnSignedInEvent?.Invoke(); }); }, connection); }
/// <summary> /// Sends a request to server, to log in as a guest /// </summary> /// <param name="callback"></param> /// <param name="connection"></param> public void SignInAsGuest(SignInCallback callback, IClientSocket connection) { var credentials = new MstProperties(); credentials.Add(MstDictKeys.USER_IS_GUEST); credentials.Add(MstDictKeys.USER_DEVICE_NAME, SystemInfo.deviceName); credentials.Add(MstDictKeys.USER_DEVICE_ID, SystemInfo.deviceUniqueIdentifier); SignIn(credentials, callback, connection); }
public Task <SignInResult> SignInAsync(Credentials credentials, bool lockoutOnFailure = true) { var loginDto = LoginDto.FromCredentials(credentials, lockoutOnFailure, DateTime.UtcNow + TimeSpan.FromSeconds(loginExpirationSeconds)); var callback = new SignInCallback <TUser>(loginDto, this); var protector = _dataProtectionProvider.CreateProtector("login"); var encodedCredentials = protector.Protect(JsonSerializer.Serialize(loginDto)); _jSRuntime.InvokeVoidAsync("shadyAuthHelpers.login", encodedCredentials, DotNetObjectReference.Create(callback)); return(callback.ResultSource.Task); }
/// <summary> /// Sends a request to server, to log in as a guest /// </summary> /// <param name="callback"></param> /// <param name="connection"></param> public void SignInAsGuest(SignInCallback callback, IClientSocket connection) { if (HasAuthToken()) { SignInWithToken(callback, connection); } else { var credentials = new MstProperties(); credentials.Add(MstDictKeys.USER_IS_GUEST); SignIn(credentials, callback, connection); } }
/// <summary> /// Sends a generic login request /// </summary> /// <param name="data"></param> /// <param name="callback"></param> public void SignIn(Dictionary <string, string> data, SignInCallback callback) { SignIn(data, callback, Connection); }
/// <summary> /// Sends a generic login request /// </summary> public void SignIn(MstProperties data, SignInCallback callback, IClientSocket connection) { Logs.Debug("Signing in..."); if (!connection.IsConnected) { callback.Invoke(null, "Not connected to server"); return; } IsNowSigningIn = true; // We first need to get an aes key // so that we can encrypt our login data Mst.Security.GetAesKey(aesKey => { if (aesKey == null) { IsNowSigningIn = false; callback.Invoke(null, "Failed to log in due to security issues"); return; } var encryptedData = Mst.Security.EncryptAES(data.ToBytes(), aesKey); connection.SendMessage((short)MstMessageCodes.SignIn, encryptedData, (status, response) => { IsNowSigningIn = false; if (status != ResponseStatus.Success) { ClearAuthToken(); callback.Invoke(null, response.AsString("Unknown error")); return; } // Parse account info var accountInfoPacket = response.Deserialize(new AccountInfoPacket()); AccountInfo = new ClientAccountInfo() { Id = accountInfoPacket.Id, Username = accountInfoPacket.Username, Email = accountInfoPacket.Email, PhoneNumber = accountInfoPacket.PhoneNumber, Facebook = accountInfoPacket.Facebook, Token = accountInfoPacket.Token, IsAdmin = accountInfoPacket.IsAdmin, IsGuest = accountInfoPacket.IsGuest, IsEmailConfirmed = accountInfoPacket.IsEmailConfirmed, Properties = accountInfoPacket.Properties, }; // If RememberMe is checked on and we are not guset, then save auth token if (RememberMe && !AccountInfo.IsGuest && !string.IsNullOrEmpty(AccountInfo.Token)) { SaveAuthToken(AccountInfo.Token); } else { ClearAuthToken(); } IsSignedIn = true; callback.Invoke(AccountInfo, null); OnSignedInEvent?.Invoke(); }); }, connection); }
/// <summary> /// Sends a generic login request /// </summary> /// <param name="data"></param> /// <param name="callback"></param> public void SignIn(MstProperties data, SignInCallback callback) { SignIn(data, callback, Connection); }
/// <summary> /// Sends a login request, using given credentials /// </summary> public void SignInWithPhoneNumber(string phoneNumber, SignInCallback callback) { SignInWithPhoneNumber(phoneNumber, callback, Connection); }
/// <summary> /// Sends a login request, using given credentials /// </summary> public void SignInWithEmail(string email, SignInCallback callback) { SignInWithEmail(email, callback, Connection); }
/// <summary> /// Sends a login request, using given credentials /// </summary> public void SignIn(string username, string password, SignInCallback callback) { SignIn(username, password, callback, Connection); }
public async Task <IActionResult> Callback([FromBody] SignInCallback callback) { await _contactsApiClient.Callback(callback); return(Ok()); }
/// <summary> /// Sends a login request, using given credentials /// </summary> public void SignInWithLoginAndPassword(string username, string password, SignInCallback callback) { SignInWithLoginAndPassword(username, password, callback, Connection); }
/// <summary> /// Sends a request to server, to log in as a guest /// </summary> /// <param name="callback"></param> public void SignInAsGuest(SignInCallback callback) { SignInAsGuest(callback, Connection); }
/// <summary> /// Sends a login request, using given token /// </summary> public void SignInWithToken(string token, SignInCallback callback) { SignInWithToken(token, callback, Connection); }
/// <summary> /// Sends a request to server, to log in with auth token /// </summary> /// <param name="callback"></param> public void SignInWithToken(SignInCallback callback) { SignInWithToken(callback, Connection); }