Esempio n. 1
0
 protected abstract Task <RawResult> RawCreateOrUpdateGoogleUserAsync(
     ISqlCallContext ctx,
     int actorId,
     int userId,
     [ParameterSource] IUserGoogleInfo info,
     CreateOrUpdateMode mode,
     CancellationToken cancellationToken);
Esempio n. 2
0
        /// <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 operation result.</returns>
        public Task <CreateOrUpdateResult> CreateOrUpdatePasswordUserAsync(ISqlCallContext ctx, int actorId, int userId, string password, CreateOrUpdateMode mode = CreateOrUpdateMode.CreateOrUpdate, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (string.IsNullOrEmpty(password))
            {
                throw new ArgumentNullException(nameof(password));
            }
            PasswordHasher p = new PasswordHasher(HashIterationCount);

            return(CreateOrUpdatePasswordUserWithRawPwdHashAsync(ctx, actorId, userId, p.HashPassword(password), mode, cancellationToken));
        }
Esempio n. 3
0
        Task <CreateOrUpdateResult> IGenericAuthenticationProvider.CreateOrUpdateUserAsync(ISqlCallContext ctx, int actorId, int userId, object payload, CreateOrUpdateMode mode, CancellationToken cancellationToken)
        {
            string password = payload as string;

            if (password == null)
            {
                throw new ArgumentException(nameof(payload));
            }
            return(CreateOrUpdatePasswordUserAsync(ctx, actorId, userId, password, mode, cancellationToken));
        }
Esempio n. 4
0
 public abstract Task <CreateOrUpdateResult> CreateOrUpdatePasswordUserWithRawPwdHashAsync(ISqlCallContext ctx, int actorId, int userId, byte[] pwdHash, CreateOrUpdateMode mode, CancellationToken cancellationToken = default(CancellationToken));
Esempio n. 5
0
        /// <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="payload">Provider specific data.</param>
        /// <param name="mode">Optionnaly configures Create, Update only or WithLogin behavior.</param>
        /// <returns>The operation result.</returns>
        public async Task <CreateOrUpdateResult> CreateOrUpdateGoogleUserAsync(ISqlCallContext ctx, int actorId, int userId, IUserGoogleInfo info, CreateOrUpdateMode mode = CreateOrUpdateMode.CreateOrUpdate, CancellationToken cancellationToken = default(CancellationToken))
        {
            var r = await RawCreateOrUpdateGoogleUserAsync(ctx, actorId, userId, info, mode, cancellationToken).ConfigureAwait(false);

            return(r.Result);
        }
Esempio n. 6
0
        Task <CreateOrUpdateResult> IGenericAuthenticationProvider.CreateOrUpdateUserAsync(ISqlCallContext ctx, int actorId, int userId, object payload, CreateOrUpdateMode mode, CancellationToken cancellationToken)
        {
            IUserGoogleInfo info = payload as IUserGoogleInfo;

            if (info == null)
            {
                throw new ArgumentException(nameof(payload));
            }
            return(CreateOrUpdateGoogleUserAsync(ctx, actorId, userId, info, mode, cancellationToken));
        }
Esempio n. 7
0
        /// <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 CreateOrUpdateResult CreateOrUpdatePasswordUser(ISqlCallContext ctx, int actorId, int userId, string password, CreateOrUpdateMode mode = CreateOrUpdateMode.CreateOrUpdate)
        {
            if (string.IsNullOrEmpty(password))
            {
                throw new ArgumentNullException(nameof(password));
            }
            PasswordHasher p = new PasswordHasher(HashIterationCount);

            return(CreateOrUpdatePasswordUserWithPwdRawHash(ctx, actorId, userId, p.HashPassword(password), mode));
        }
Esempio n. 8
0
 public abstract CreateOrUpdateResult CreateOrUpdatePasswordUserWithPwdRawHash(ISqlCallContext ctx, int actorId, int userId, byte[] pwdHash, CreateOrUpdateMode mode);
Esempio n. 9
0
 protected abstract RawResult RawCreateOrUpdateGoogleUser(
     ISqlCallContext ctx,
     int actorId,
     int userId,
     [ParameterSource] IUserGoogleInfo info,
     CreateOrUpdateMode mode);
Esempio n. 10
0
        /// <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="payload">Provider specific data.</param>
        /// <param name="mode">Optionnaly configures Create, Update only or WithLogin behavior.</param>
        /// <returns>The operation result.</returns>
        public CreateOrUpdateResult CreateOrUpdateGoogleUser(ISqlCallContext ctx, int actorId, int userId, IUserGoogleInfo info, CreateOrUpdateMode mode = CreateOrUpdateMode.CreateOrUpdate)
        {
            var r = RawCreateOrUpdateGoogleUser(ctx, actorId, userId, info, mode);

            return(r.Result);
        }