public void ParseToken_should_return_null_when_token_is_invalid()
        {
            //when
            var res = sut.ParseToken("asdf");

            //then
            Assert.Null(res);
        }
示例#2
0
        public string GetWebSdkConfig()
        {
            var parsedToken = _authTokenParser.ParseToken(_credentialProvider.Token);

            if (parsedToken == null)
            {
                throw new Exception("The provided token is invalid.");
            }

            IDictionary <string, object> configParams = new Dictionary <string, object>()
            {
                { "truCodeUrl", _configuration.EndpointUrl },
                { "relyingPartyId", parsedToken.Subject }
            };

            return(RequestResponseJsonConverter.Serialize(configParams)
                   .Replace(System.Environment.NewLine, string.Empty)
                   .Replace("  ", ""));
        }