Esempio n. 1
0
        private static string GetSubjectId(OAuthTokenResponse tokens)
        {
            var payloadString = tokens.AccessToken.Split('.')[1];

            payloadString = Encoding.UTF8.GetString(EsiaHelpers.Base64Decode(payloadString));
            var payload = JObject.Parse(payloadString);

            return(payload[EsiaConstants.SbjIdUrn]?.ToString());
        }
        public string GenerateClientSecret()
        {
            State     = Options.State.ToString("D");
            Timestamp = DateTime.Now.ToString("yyyy.MM.dd HH:mm:ss zz00");
            Scope     = FormatScope(Options.Scope);

            var signMessage      = Scope + Timestamp + Options.ClientId + State;
            var encodedSignature = SignMessage(Encoding.UTF8.GetBytes(signMessage));

            Secret = EsiaHelpers.Base64UrlEncode(encodedSignature);

            return(Secret);
        }