Пример #1
0
        public Task <UserState> ParseResponse(string url)
        {
            return(HandleErrors(nameof(ParseResponse), async() =>
            {
                var response = ResponseParser.ParseAuthenticationUrl(url);
                var state = await Store.GetAuthState();

                ResponseParser.EnsureValidResponse(response, state);
                ResponseParser.EnsureValidState(response, state);
                ResponseParser.EnsureTokenOrCodePresence(response, state);

                await Store.RemoveAuthState();

                if (state.IsCodeFlow)
                {
                    response.Merge(await RequestToken(response, state));
                }

                var token = await ResponseParser.ParseResponse(response, state);

                var claims = ResponseParser.ParsePayloadClaims(token);
                if (response.LoadUserInfo)
                {
                    claims.Merge(await LoadUserInfo(response.AccessToken));
                }

                var userState = ResponseParser.ParseUserState(response, token, claims);

                return userState;
            }));
        }
        public Task ParseResponse(string url)
        {
            return(HandleErrors(nameof(ParseResponse), async() =>
            {
                var response = ResponseParser.ParseLogoutUrl(url);
                var state = await Store.GetLogoutState();

                ResponseParser.EnsureValidResponse(response, state);
                ResponseParser.EnsureValidState(response, state);

                await Store.RemoveLogoutState();
            }));
        }