/// <summary> /// constructor /// </summary> public LineAuthenticationMiddleware(OwinMiddleware next, IAppBuilder app, LineAuthenticationOptions options) : base(next, options) { if (string.IsNullOrWhiteSpace(Options.ChannelId)) { throw new ArgumentException("ChannelId is missing."); } if (string.IsNullOrWhiteSpace(Options.ChannelSecret)) { throw new ArgumentException("ChannelSecret is missing."); } if (string.IsNullOrWhiteSpace(Options.RedirectUri)) { throw new ArgumentException("RedirectUri is missing."); } lineLoginClient = new LineLoginClient(Options.ChannelId, options.ChannelSecret, options.RedirectUri, null, options.Scope); _logger = app.CreateLogger <LineAuthenticationMiddleware>(); if (Options.StateDataFormat == null) { var dataProtector = app.CreateDataProtector( typeof(LineAuthenticationMiddleware).FullName, Options.AuthenticationType, "v1"); Options.StateDataFormat = new PropertiesDataFormat(dataProtector); } if (string.IsNullOrEmpty(Options.SignInAsAuthenticationType)) { Options.SignInAsAuthenticationType = app.GetDefaultSignInAsAuthenticationType(); } }
/// <summary> /// Constructor /// </summary> public LineAuthenticationHandler(LineLoginClient loginClient, ILogger logger) { _logger = logger; this.loginClient = loginClient; }
public HomeController() { client = new LineLoginClient(channelId, channelSecret, redirectUri, "test", Scope.Profile | Scope.OpenId); }