/// <summary>
        /// Challenges <see cref="IUserOidcInfo"/> data to identify a user.
        /// Note that a successful challenge may have side effects such as updating claims, access tokens or other data
        /// related to the user and this provider.
        /// </summary>
        /// <param name="ctx">The call context to use.</param>
        /// <param name="info">The payload to challenge.</param>
        /// <param name="actualLogin">Set it to false to avoid login side-effect (such as updating the LastLoginTime) on success.</param>
        /// <returns>The login result.</returns>
        public LoginResult LoginUser(ISqlCallContext ctx, IUserOidcInfo info, bool actualLogin = true)
        {
            var mode = actualLogin
                        ? UCLMode.UpdateOnly | UCLMode.WithActualLogin
                        : UCLMode.UpdateOnly | UCLMode.WithCheckLogin;
            var r = UserOidcUCL(ctx, 1, 0, info, mode);

            return(r.LoginResult);
        }
Exemple #2
0
 /// <summary>
 /// Gets either "Oidc" or "Oidc.<see cref="IUserOidcInfo.SchemeSuffix"/>".
 /// </summary>
 /// <param name="this">This IUserOidcInfo.</param>
 /// <returns>The scheme.</returns>
 public static string GetScheme(this IUserOidcInfo @this)
 {
     return(string.IsNullOrEmpty(@this.SchemeSuffix)
             ? "Oidc"
             : "Oidc." + @this.SchemeSuffix);
 }
 protected abstract UCLResult UserOidcUCL(
     ISqlCallContext ctx,
     int actorId,
     int userId,
     [ParameterSource] IUserOidcInfo info,
     UCLMode 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="IUserOidcInfo"/> poco.</param>
 /// <param name="mode">Optionnaly configures Create, Update only or WithLogin behavior.</param>
 /// <returns>The result.</returns>
 public UCLResult CreateOrUpdateOidcUser(ISqlCallContext ctx, int actorId, int userId, IUserOidcInfo info, UCLMode mode = UCLMode.CreateOrUpdate)
 {
     return(UserOidcUCL(ctx, actorId, userId, info, mode));
 }