private TSchemeDefinition FromEntity(ExternalProvider entity)
        {
            var hanlderType = _serializer.DeserializeType(entity.SerializedHandlerType);

            return(new TSchemeDefinition
            {
                Scheme = entity.Id,
                DisplayName = entity.DisplayName,
                HandlerType = hanlderType,
                Options = _serializer.DeserializeOptions(entity.SerializedOptions, hanlderType.GetAuthenticationSchemeOptionsType())
            });
        }
        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,
                HandlerType = handlerType,
                Options     = options,
                Scheme      = entity.Id
            }, cancellationToken).ConfigureAwait(false);

            if (_providerClient != null)
            {
                await _providerClient.ProviderAdded(entity.Id, cancellationToken).ConfigureAwait(false);
            }
            return(entity);
        }
Esempio n. 3
0
        private SchemeDefinition CreateSchemeDefinition(ExternalProvider entity)
        {
            var handlerType = _serializer.DeserializeType(entity.SerializedHandlerType);

            return(new()
            {
                DisplayName = entity.DisplayName,
                HandlerType = handlerType,
                Options = _serializer.DeserializeOptions(entity.SerializedOptions, handlerType.GetAuthenticationSchemeOptionsType()),
                Scheme = entity.Id
            });
        }