protected override async Task OnInitializedAsync()
        {
            var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();

            if (authState.User.Identity.IsAuthenticated)
            {
                await TwitchService.LoadChannelData();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// OnInitializedAsync 方法
        /// </summary>
        /// <returns></returns>
        protected override async System.Threading.Tasks.Task OnInitializedAsync()
        {
            if (AuthenticationStateProvider != null)
            {
                var state = await AuthenticationStateProvider.GetAuthenticationStateAsync();

                UserName = state?.User.Identity !.Name;
            }
        }
 public AuthenticationManager(
     HttpClient httpClient,
     ILocalStorageService localStorage,
     AuthenticationStateProvider authenticationStateProvider)
 {
     _httpClient   = httpClient;
     _localStorage = localStorage;
     _authenticationStateProvider = authenticationStateProvider;
 }
Exemplo n.º 4
0
 public ServerAuthenticationService(
     AuthenticationStateProvider authenticationStateProvider,
     IPrincipalStorageProvider principalStorageProvider,
     IPrincipalProvider principalProvider)
 {
     _authenticationStateProvider = authenticationStateProvider as DelayedAuthenticationStateProvider;
     _principalStorageProvider    = principalStorageProvider;
     _principalProvider           = principalProvider;
 }
Exemplo n.º 5
0
 public ImageService(
     ApplicationDbContext dbContext,
     BlobStorageService blobStorage,
     AuthenticationStateProvider authenticationStateProvider)
 {
     this.dbContext   = dbContext;
     this.blobStorage = blobStorage;
     this.authenticationStateProvider = authenticationStateProvider;
 }
Exemplo n.º 6
0
        public AuthService(HttpClient httpClient, AuthenticationStateProvider authStateProvider, ILocalStorageService localStorage)
        {
            this.httpClient        = httpClient;
            this.authStateProvider = authStateProvider;
            this.localStorage      = localStorage;

            Console.WriteLine("Created AuthService instance.");
            Console.WriteLine($"(AuthService) HttpClient requestheader auth: {httpClient.DefaultRequestHeaders.Authorization}");
        }
Exemplo n.º 7
0
 public AuthService(
     HttpClient httpClient,
     ILocalStorageService localStorage,
     AuthenticationStateProvider authenticationStateProvider)
 {
     this.httpClient   = httpClient;
     this.localStorage = localStorage;
     this.authenticationStateProvider = authenticationStateProvider;
 }
Exemplo n.º 8
0
 public AuthService(HttpClient httpClient,
                    AuthenticationStateProvider authenticationStateProvider,
                    ILocalStorageService localStorage, IHttpService httpService)
 {
     _httpClient = httpClient;
     _authenticationStateProvider = authenticationStateProvider;
     _localStorage = localStorage;
     _httptService = httpService;
 }
Exemplo n.º 9
0
 public ServerSideAuthService(
     IButtonActionHandlerResolver buttonActionHandlerResolver,
     IAuthorizationService authorizationService,
     AuthenticationStateProvider authenticationStateProvider)
 {
     _buttonActionHandlerResolver = buttonActionHandlerResolver;
     _authorizationService        = authorizationService;
     _authenticationStateProvider = authenticationStateProvider;
 }
Exemplo n.º 10
0
 public AuthenServices(ILocalStorageService localStorage, ISessionStorageService sessionStorage, AuthenticationStateProvider authenStateProvider, IApiClientService <UserLoginModel> api, HttpClient httpClient)
 {
     _localStorage        = localStorage;
     _sessionStorage      = sessionStorage;
     _api                 = api;
     _httpClient          = httpClient;
     _authenStateProvider = authenStateProvider;
     checktUser();
 }
Exemplo n.º 11
0
        public UserIdService(IHttpContextAccessor httpContextAccessor, AuthenticationStateProvider authenticationStateProvider)
        {
            // https://github.com/dotnet/aspnetcore/issues/17585
            // https://github.com/dotnet/aspnetcore/issues/18183
            // https://github.com/dotnet/aspnetcore/issues/14090
            this.User            = httpContextAccessor.HttpContext?.User;
            this.RemoteIpAddress = httpContextAccessor.HttpContext?.Connection.RemoteIpAddress;

            _authenticationStateProvider = authenticationStateProvider;
        }
 public AuthenticationUserService(IHttpService httpService,
                                  NavigationManager navigationManager,
                                  ILocalStorageService localStorageService,
                                  AuthenticationStateProvider authenticationStateProvider)
 {
     _httpClient                  = httpService;
     _navigationManager           = navigationManager;
     _localStorageService         = localStorageService;
     _authenticationStateProvider = authenticationStateProvider;
 }
Exemplo n.º 13
0
 public AuthService(HttpClient httpClient,
                    AuthenticationStateProvider authenticationStateProvider,
                    ILocalStorageService localStorage,
                    ConfigService _configService)
 {
     _httpClient = httpClient;
     _authenticationStateProvider = authenticationStateProvider;
     _localStorage = localStorage;
     configService = _configService;
 }
Exemplo n.º 14
0
 public AuthService(AuthenticationStateProvider authenticationStateProvider,
                    ServerHandler serverHandler,
                    SignUpService signUpService,
                    SignInService signInService)
 {
     this.authenticationStateProvider = authenticationStateProvider;
     this.serverHandler = serverHandler;
     this.signUpService = signUpService;
     this.signInService = signInService;
 }
Exemplo n.º 15
0
 public AuthentificationRepository(IConfiguration configuration,
                                   IHttpClientFactory httpClientFactory,
                                   ILocalStorageService localStorage,
                                   AuthenticationStateProvider authenticationStateProvider)
 {
     _ClientFactory = httpClientFactory;
     apiUrl         = configuration.GetValue <string>(ConventionalUrls.BaseUrlConfigurationKey);
     _LocalStorage  = localStorage;
     _AuthenticationStateProvider = authenticationStateProvider;
 }
Exemplo n.º 16
0
 public IdentityApiClient(HttpClient httpClient,
                          AuthenticationStateProvider authenticationStateProvider,
                          SignInManager <ApplicationUser> signInManager,
                          IJSRuntime jsRuntime)
 {
     _httpClient = httpClient;
     _authenticationStateProvider = authenticationStateProvider;
     _signInManager = signInManager;
     _jsRuntime     = jsRuntime;
 }
Exemplo n.º 17
0
        public UserIdentificationService(AuthenticationStateProvider authenticationStateProvider, ILocalStorageService localStorageService, ISyncLocalStorageService syncLocalStorageService, NavigationManager navigationManager)
        {
            _authenticationStateProvider = authenticationStateProvider;
            _localStorageService         = localStorageService;
            _syncLocalStorageService     = syncLocalStorageService;

            _localStorageKey = navigationManager.BaseUri + "MyChatApp-GuestUserName";;

            _authenticationStateProvider.AuthenticationStateChanged += authenticationStateProvider_AuthenticationStateChanged;
        }
 public AuthService(AuthenticationStateProvider authenticationStateProvider,
                    IJSRuntime jsRuntime,
                    HttpClient httpClient,
                    ISettingsService settingsService)
 {
     authenticationStateProvider_ = authenticationStateProvider;
     jsRuntime_       = jsRuntime;
     httpClient_      = httpClient;
     settingsService_ = settingsService;
 }
Exemplo n.º 19
0
 public AuthenticationService(HttpClient httpClient,
                              AuthenticationStateProvider authenticationStateProvider,
                              ILocalStorageService localStorage,
                              SettingsService settings)
 {
     _localStorage = localStorage;
     _authenticationStateProvider = authenticationStateProvider;
     _httpClient = httpClient;
     _settings   = settings;
 }
Exemplo n.º 20
0
        protected override async Task OnInitializedAsync()
        {
            // TODO: #11 Move task metadata initialization into separate service
            var state = await AuthenticationStateProvider
                        .GetAuthenticationStateAsync()
                        .ConfigureAwait(false);

            _task.Metadata.Id    = Guid.NewGuid().ToString();
            _task.Metadata.Owner = state.User.FindFirst(claim => claim.Type == ClaimTypes.Email).Value;
        }
Exemplo n.º 21
0
        protected override async Task OnInitializedAsync()
        {
            await base.OnInitializedAsync();

            AuthenticationState authenticationState = await AuthenticationStateProvider.GetAuthenticationStateAsync();

            ClaimsPrincipal = authenticationState.User;
            CurrentUser     = authenticationState.User.ToAccountListing();
            CurrentToken    = HttpContextAccessor?.HttpContext?.Request?.Cookies[ApiTokenAuthenticationHandler.CookieName];
        }
Exemplo n.º 22
0
 public UserStateEffects(
     KeyValueStore kvs,
     AuthenticationStateProvider authenticationStateProvider,
     UrlProvider urlProvider
     )
 {
     _kvs = kvs;
     _authenticationStateProvider = authenticationStateProvider;
     _urlProvider = urlProvider;
 }
Exemplo n.º 23
0
 public AuthenticationService(HttpClient client,
                              AuthenticationStateProvider authStateProvider,
                              ILocalStorageService localStorage,
                              NavigationManager navManager)
 {
     _client            = client;
     _authStateProvider = authStateProvider;
     _localStorage      = localStorage;
     _navManager        = navManager;
 }
Exemplo n.º 24
0
        public CategoryManager(HttpClient apiClient,
                               AuthenticationStateProvider apiAuthenticationStateProvider)
        {
            _apiClient = apiClient;
            _apiAuthenticationStateProvider = apiAuthenticationStateProvider;

            _apiAuthenticationStateProvider.AuthenticationStateChanged += OnAuthenticationChanged;

            _ = GetAllCategories();
        }
Exemplo n.º 25
0
 public OneTimeTokenService(IAdminStore <OneTimeToken> store,
                            AuthenticationStateProvider state,
                            IAccessTokenProvider provider,
                            IOptions <RemoteAuthenticationOptions <OidcProviderOptions> > options)
 {
     _store         = store ?? throw new ArgumentNullException(nameof(store));
     _stateProvider = state ?? throw new ArgumentNullException(nameof(state));
     _provider      = provider ?? throw new ArgumentNullException(nameof(provider));
     _options       = options ?? throw new ArgumentNullException(nameof(options));
 }
Exemplo n.º 26
0
 public AuthService(HttpClient httpClient,
                    AuthenticationStateProvider authenticationStateProvider,
                    ILocalStorageService localStorage,
                    ILogger <AuthService> logger)
 {
     HttpClient = httpClient;
     _authenticationStateProvider = authenticationStateProvider;
     _localStorage = localStorage;
     Logger        = logger;
 }
Exemplo n.º 27
0
        /// <summary>
        ///
        /// </summary>
        protected override async Task OnParametersSetAsync()
        {
            if (AuthenticationStateProvider != null)
            {
                var user = await AuthenticationStateProvider.GetAuthenticationStateAsync();

                var url = new UriBuilder(NavigationManager?.Uri ?? "").Path;
                authorizated = AuthorizationServices != null && AuthorizationServices.Authorizate(user.User, url.ToMvcMenuUrl(), Key);
            }
        }
Exemplo n.º 28
0
 /// <summary>
 /// 認証状態を認証済み設定します。
 /// </summary>
 /// <param name="provider">プロバイダ。</param>
 /// <param name="userId">ユーザーID。</param>
 /// <param name="token">トークン。</param>
 /// <remarks>
 /// <see cref="AuthenticationStateProvider.NotifyAuthenticationStateChanged"/> を呼び出すためのラップメソッド。
 /// </remarks>
 public static void Authroize(
     this AuthenticationStateProvider provider,
     string userId,
     string token
     )
 {
     ((CustomAuthenticationStateProvider)provider).Authroize(
         userId: userId,
         token: token
         );
 }
Exemplo n.º 29
0
 public AuthenticationHttpService(
     AuthenticationStateProvider authenticationStateProvider,
     ILocalStorageService localStorage,
     IConfiguration config,
     HttpClient httpClient)
 {
     _authenticationStateProvider = authenticationStateProvider;
     _localStorage = localStorage;
     _config       = config;
     _httpClient   = httpClient;
 }
Exemplo n.º 30
0
 public HackSystemAuthenticationStateHandler(
     ILogger <HackSystemAuthenticationStateHandler> logger,
     IOptionsMonitor <HackSystemAuthenticationOptions> options,
     AuthenticationStateProvider authenticationStateProvider,
     ICookieStorageService cookieStorageService)
 {
     this.logger  = logger;
     this.options = options.CurrentValue;
     this.cookieStorageService        = cookieStorageService;
     this.authenticationStateProvider = authenticationStateProvider as IHackSystemAuthenticationStateProvider;
 }