public async Task <IEndpointResult> ProcessAsync(ArbitraryNoSubjectRequest request) { var result = await ProcessRawAsync(request); if (result.TokenErrorResult != null) { return(result.TokenErrorResult); } return(result.TokenResult); }
public async Task <TokenRawResult> ProcessRawAsync(ArbitraryNoSubjectRequest request) { Dictionary <string, StringValues> fields = new Dictionary <string, StringValues> { { "client_id", request.ClientId }, { "grant_type", "arbitrary_no_subject" }, }; string scope = ""; if (request.Scopes != null) { foreach (var item in request.Scopes) { scope += $"{item} "; } scope.TrimEnd(); fields.Add("scope", scope); } if (request.ArbitraryClaims != null) { fields.Add("arbitrary_claims", JsonConvert.SerializeObject(request.ArbitraryClaims)); } if (request.ArbitraryAmrs != null) { fields.Add("arbitrary_amrs", JsonConvert.SerializeObject(request.ArbitraryAmrs)); } if (request.ArbitraryAudiences != null) { fields.Add("arbitrary_audiences", JsonConvert.SerializeObject(request.ArbitraryAudiences)); } if (request.CustomPayload != null) { fields.Add("custom_payload", JsonConvert.SerializeObject(request.CustomPayload)); } var formCollection = new FormCollection(fields); return(await ProcessRawAsync(formCollection)); }