Exemplo n.º 1
0
        public void Initialize(IAppBuilder app, OioIdwsAuthenticationOptions options, ILogger logger)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            _logger = logger;
        }
        public void Initialize(IAppBuilder app, OioIdwsAuthenticationOptions options, ILogger logger)
        {
            object tmp;

            if (!app.Properties.TryGetValue(OioIdwsAuthorizationServiceMiddleware.TokenRetrievalKey, out tmp) ||
                (_tokenRetrieval = (tmp as Func <string, Task <OioIdwsToken> >)) == null)
            {
                throw new ArgumentException($"When option '{nameof(options.TokenProvider)}' is set to '{nameof(InMemoryTokenProvider)}', the {nameof(OioIdwsAuthorizationServiceMiddleware)} must be configured as well.");
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Configures the OWIN pipeline to use OIO IDWS service authentication. Defaults to run at the <see cref="PipelineStage.Authenticate"/> stage
 /// </summary>
 /// <param name="app"></param>
 /// <param name="options"></param>
 /// <param name="stage"></param>
 /// <returns></returns>
 public static IAppBuilder UseOioIdwsAuthentication(this IAppBuilder app, OioIdwsAuthenticationOptions options, PipelineStage stage = PipelineStage.Authenticate)
 {
     return(app
            .Use <OioIdwsAuthenticationMiddleware>(app, options)
            .UseStageMarker(stage));
 }