Example #1
0
        public async Task <ExternalProvider> CreateAsync(ExternalProvider entity, CancellationToken cancellationToken = default)
        {
            await _manager.AddAsync(CreateSchemeDefinition(entity), cancellationToken).ConfigureAwait(false);

            await _providerClient.ProviderAddedAsync(entity.Id, cancellationToken).ConfigureAwait(false);

            return(entity);
        }
Example #2
0
        public async Task <ExternalProvider> CreateAsync(ExternalProvider entity, CancellationToken cancellationToken = default)
        {
            var handlerType = _serializer.DeserializeType(entity.SerializedHandlerType);
            var options     = _serializer.DeserializeOptions(entity.SerializedOptions, handlerType.GetAuthenticationSchemeOptionsType());

            SanetizeCallbackPath(entity, options);

            await _manager.AddAsync(new SchemeDefinition
            {
                DisplayName = entity.DisplayName,
                StoreClaims = entity.StoreClaims,
                MapDefaultOutboundClaimType = entity.MapDefaultOutboundClaimType,
                HandlerType = handlerType,
                Options     = options,
                Scheme      = entity.Id
            }, cancellationToken).ConfigureAwait(false);

            if (_providerClient != null)
            {
                await _providerClient.ProviderAddedAsync(entity.Id, cancellationToken).ConfigureAwait(false);
            }
            return(entity);
        }