mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 17:40:50 +08:00 
			
		
		
		
	
				
					committed by
					
						
						Marcelo Castagna
					
				
			
			
				
	
			
			
			
						parent
						
							6f95b20b48
						
					
				
				
					commit
					49b2a0f0ce
				
			@@ -1,6 +1,6 @@
 | 
			
		||||
namespace Ocelot.Infrastructure.Claims.Parser
 | 
			
		||||
{
 | 
			
		||||
    using Errors;
 | 
			
		||||
    using Microsoft.Extensions.Primitives;
 | 
			
		||||
    using Responses;
 | 
			
		||||
    using System.Collections.Generic;
 | 
			
		||||
    using System.Linq;
 | 
			
		||||
@@ -45,11 +45,11 @@
 | 
			
		||||
 | 
			
		||||
        private Response<string> GetValue(IEnumerable<Claim> claims, string key)
 | 
			
		||||
        {
 | 
			
		||||
            var claim = claims.FirstOrDefault(c => c.Type == key);
 | 
			
		||||
            var claimValues = claims.Where(c => c.Type == key).Select(c => c.Value).ToArray();
 | 
			
		||||
 | 
			
		||||
            if (claim != null)
 | 
			
		||||
            if (claimValues.Length > 0)
 | 
			
		||||
            {
 | 
			
		||||
                return new OkResponse<string>(claim.Value);
 | 
			
		||||
                return new OkResponse<string>(new StringValues(claimValues).ToString());
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return new ErrorResponse<string>(new CannotFindClaimError($"Cannot find claim for key: {key}"));
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user