Exemple #1
0
        /// <summary>
        /// This method is called whenever claims about the user are requested (e.g. during token creation or via the userinfo endpoint)
        /// </summary>
        /// <param name="context">The context.</param>
        /// <returns></returns>
        public Task GetProfileDataAsync(ProfileDataRequestContext context)
        {
            _logger.LogDebug("Get profile called for {subject} from {client} with {claimTypes} because {caller}",
                             context.Subject.GetSubjectId(),
                             context.Client.ClientName,
                             context.RequestedClaimTypes,
                             context.Caller);

            if (context.RequestedClaimTypes.Any())
            {
                context.AddClaims(context.Subject.Claims);
            }

            return(Task.FromResult(0));
        }
Exemple #2
0
        /// <summary>
        /// This method is called whenever claims about the user are requested (e.g. during token creation or via the userinfo endpoint)
        /// </summary>
        /// <param name="context">The context.</param>
        /// <returns></returns>
        public virtual Task GetProfileDataAsync(ProfileDataRequestContext context)
        {
            Logger.LogDebug("Get profile called for subject {subject} from client {client} with claim types {claimTypes} via {caller}",
                            context.Subject.GetSubjectId(),
                            context.Client.ClientName ?? context.Client.ClientId,
                            context.RequestedClaimTypes,
                            context.Caller);

            if (context.RequestedClaimTypes.Any())
            {
                var user = Users.FindBySubjectId(context.Subject.GetSubjectId());
                context.AddClaims(user.Claims);
            }

            return(Task.FromResult(0));
        }