protected abstract Task <UCLResult> FacebookUserUCLAsync( ISqlCallContext ctx, int actorId, int userId, [ParameterSource] IUserFacebookInfo info, UCLMode mode, CancellationToken cancellationToken);
protected abstract Task <UCLResult> UserOidcULC( ISqlCallContext ctx, int actorId, int userId, [ParameterSource] IUserOidcInfo info, UCLMode mode, CancellationToken cancellationToken);
/// <summary> /// Creates or updates a user entry for this provider. /// This is the "binding account" feature since it binds an external identity to /// an already existing user that may already be registered into other authencation providers. /// </summary> /// <param name="ctx">The call context to use.</param> /// <param name="actorId">The acting actor identifier.</param> /// <param name="userId">The user identifier that must be registered.</param> /// <param name="info">Provider specific data: the <see cref="IUserSimpleCodeInfo"/> poco.</param> /// <param name="mode">Optionnaly configures Create, Update only or WithLogin behavior.</param> /// <returns>The operation result.</returns> public UCLResult CreateOrUpdateSimpleCodeUser(ISqlCallContext ctx, int actorId, int userId, IUserSimpleCodeInfo info, UCLMode mode = UCLMode.CreateOrUpdate) { return(UserSimpleCodeUCL(ctx, actorId, userId, info, mode)); }
/// <summary> /// Creates or updates a user entry for this provider. /// This is the "binding account" feature since it binds an external identity to /// an already existing user that may already be registered into other authencation providers. /// </summary> /// <param name="ctx">The call context to use.</param> /// <param name="actorId">The acting actor identifier.</param> /// <param name="userId">The user identifier that must be registered.</param> /// <param name="info">Provider specific data: the <see cref="IUserGitLabInfo"/> poco.</param> /// <param name="mode">Optionnaly configures Create, Update only or WithLogin behavior.</param> /// <returns>The result.</returns> public UCLResult CreateOrUpdateGitLabUser(ISqlCallContext ctx, int actorId, int userId, IUserGitLabInfo info, UCLMode mode = UCLMode.CreateOrUpdate) { return(UserGitLabUCL(ctx, actorId, userId, info, mode)); }
/// <summary> /// Associates a PasswordUser to an existing user. /// </summary> /// <param name="ctx">The call context to use.</param> /// <param name="actorId">The acting actor identifier.</param> /// <param name="userId">The user identifier that must have a password.</param> /// <param name="password">The initial password. Can not be null nor empty.</param> /// <param name="mode">Optionnaly configures Create, Update only or WithLogin behavior.</param> /// <param name="cancellationToken">Optional cancellation token.</param> /// <returns>The result.</returns> public Task <UCLResult> CreateOrUpdatePasswordUserAsync(ISqlCallContext ctx, int actorId, int userId, string password, UCLMode mode = UCLMode.CreateOrUpdate, CancellationToken cancellationToken = default(CancellationToken)) { if (string.IsNullOrEmpty(password)) { throw new ArgumentNullException(nameof(password)); } PasswordHasher p = new PasswordHasher(HashIterationCount); return(PasswordUserUCLAsync(ctx, actorId, userId, p.HashPassword(password), mode, null, cancellationToken)); }
protected abstract Task <UCLResult> PasswordUserUCLAsync(ISqlCallContext ctx, int actorId, int userId, byte[] pwdHash, UCLMode mode, int?loginFailureCode = null, CancellationToken cancellationToken = default(CancellationToken));
/// <summary> /// Creates or updates a user entry for this provider. /// This is the "binding account" feature since it binds an external identity to /// an already existing user that may already be registered into other authencation providers. /// </summary> /// <param name="ctx">The call context to use.</param> /// <param name="actorId">The acting actor identifier.</param> /// <param name="userId">The user identifier that must be registered.</param> /// <param name="info">Provider specific data: the <see cref="IUserOidcInfo"/> poco.</param> /// <param name="mode">Optionnaly configures Create, Update only or WithLogin behavior.</param> /// <param name="cancellationToken">Optional cancellation token.</param> /// <returns>The result.</returns> public async Task <UCLResult> CreateOrUpdateOidcUserAsync(ISqlCallContext ctx, int actorId, int userId, IUserOidcInfo info, UCLMode mode = UCLMode.CreateOrUpdate, CancellationToken cancellationToken = default(CancellationToken)) { var r = await UserOidcULC(ctx, actorId, userId, info, mode, cancellationToken).ConfigureAwait(false); return(r); }
Task <UCLResult> IGenericAuthenticationProvider.CreateOrUpdateUserAsync(ISqlCallContext ctx, int actorId, int userId, object payload, UCLMode mode, CancellationToken cancellationToken) { IUserOidcInfo info = _infoFactory.ExtractPayload(payload); return(CreateOrUpdateOidcUserAsync(ctx, actorId, userId, info, mode, cancellationToken)); }
/// <summary> /// Associates a PasswordUser to an existing user. /// </summary> /// <param name="ctx">The call context to use.</param> /// <param name="actorId">The acting actor identifier.</param> /// <param name="userId">The user identifier that must have a password.</param> /// <param name="password">The initial password. Can not be null nor empty.</param> /// <param name="mode">Optionnaly configures Create or Update only behavior.</param> /// <returns>The operation result.</returns> public UCLResult CreateOrUpdatePasswordUser(ISqlCallContext ctx, int actorId, int userId, string password, UCLMode mode = UCLMode.CreateOrUpdate) { if (string.IsNullOrEmpty(password)) { throw new ArgumentNullException(nameof(password)); } PasswordHasher p = new PasswordHasher(HashIterationCount); return(PasswordUserUCL(ctx, actorId, userId, p.HashPassword(password), mode, null)); }
/// <summary> /// Creates or updates a guest actor entry. /// This is the "binding actor feature" since it binds a guest actor to an already existing actor. /// When both an <paramref name="guestActorId"/> and <see cref="IGuestActorInfo.Token"/> are provided /// they must match otherwise an exception will be thrown. /// Otherwise, if no <see cref="IGuestActorInfo.Token"/> is provider then the <paramref name="guestActorId"/> /// will be bound to a new guest actor, if no binding currently exists. If no <paramref name="guestActorId"/> /// is provided a new one will be created. /// </summary> /// <param name="ctx">The call context to use.</param> /// <param name="actorId">The acting actor identifier.</param> /// <param name="guestActorId">The guest actor identifier that must be registered.</param> /// <param name="info">Provider specific data: the <see cref="IGuestActorInfo"/> poco.</param> /// <param name="mode">Optionally configures Create, Update only or WithLogin behavior.</param> /// <returns>The <see cref="UCLResult"/>.</returns> public UCLResult CreateOrUpdateGuestActor(ISqlCallContext ctx, int actorId, int guestActorId, IGuestActorInfo info, UCLMode mode = UCLMode.CreateOrUpdate) => GuestActorUCL(ctx, actorId, guestActorId, info, mode);
protected abstract UCLResult GuestActorUCL(ISqlCallContext ctx, int actorId, int userId, [ParameterSource] IGuestActorInfo info, UCLMode mode);
Task <UCLResult> IGenericAuthenticationProvider.CreateOrUpdateUserAsync(ISqlCallContext ctx, int actorId, int userId, object payload, UCLMode mode, CancellationToken cancellationToken) => CreateOrUpdateGuestActorAsync(ctx, actorId, userId, _infoFactory.ExtractPayload(payload), mode, cancellationToken);
UCLResult IGenericAuthenticationProvider.CreateOrUpdateUser(ISqlCallContext ctx, int actorId, int userId, object payload, UCLMode mode) => CreateOrUpdateGuestActor(ctx, actorId, userId, _infoFactory.ExtractPayload(payload), mode);
/// <summary> /// Creates or updates a guest actor entry. /// This is the "binding actor feature" since it binds a guest actor to an already existing actor. /// When both an <paramref name="guestActorId"/> and <see cref="IGuestActorInfo.Token"/> are provided /// they must match otherwise an exception will be thrown. /// Otherwise, if no <see cref="IGuestActorInfo.Token"/> is provider then the <paramref name="guestActorId"/> /// will be bound to a new guest actor, if no binding currently exists. If no <paramref name="guestActorId"/> /// is provided a new one will be created. /// </summary> /// <param name="ctx">The call context to use.</param> /// <param name="actorId">The acting actor identifier.</param> /// <param name="guestActorId">The guest actor identifier that must be registered.</param> /// <param name="info">Provider specific data: the <see cref="IGuestActorInfo"/> poco.</param> /// <param name="mode">Optionally configures Create, Update only or WithLogin behavior.</param> /// <param name="cancellationToken">Optional cancellation token.</param> /// <returns>The <see cref="UCLResult"/>.</returns> public async Task <UCLResult> CreateOrUpdateGuestActorAsync(ISqlCallContext ctx, int actorId, int guestActorId, IGuestActorInfo info, UCLMode mode = UCLMode.CreateOrUpdate, CancellationToken cancellationToken = default) => await GuestActorUCLAsync(ctx, actorId, guestActorId, info, mode, cancellationToken);
protected abstract UCLResult UserSimpleCodeUCL( ISqlCallContext ctx, int actorId, int userId, [ParameterSource] IUserSimpleCodeInfo info, UCLMode mode);
UCLResult IGenericAuthenticationProvider.CreateOrUpdateUser(ISqlCallContext ctx, int actorId, int userId, object payload, UCLMode mode) { IUserOidcInfo info = _infoFactory.ExtractPayload(payload); return(CreateOrUpdateOidcUser(ctx, actorId, userId, info, mode)); }
Task <UCLResult> IGenericAuthenticationProvider.CreateOrUpdateUserAsync(ISqlCallContext ctx, int actorId, int userId, object payload, UCLMode mode, CancellationToken cancellationToken) { string password = payload as string; if (password == null) { throw new ArgumentException("Must be a string (the password).", nameof(payload)); } return(_basic.CreateOrUpdatePasswordUserAsync(ctx, actorId, userId, password, mode, cancellationToken)); }
protected abstract UCLResult PasswordUserUCL(ISqlCallContext ctx, int actorId, int userId, byte[] pwdHash, UCLMode mode, int?loginFailureCode);