/// <summary> /// Allows for setting a UserAccessTokenParameter /// </summary> /// <param name="builder"></param> /// <param name="bffUserAccessTokenParameters"></param> /// <typeparam name="TBuilder"></typeparam> /// <returns></returns> public static TBuilder WithUserAccessTokenParameter <TBuilder>(this TBuilder builder, BffUserAccessTokenParameters bffUserAccessTokenParameters) where TBuilder : IEndpointConventionBuilder { builder.Add(endpointBuilder => { var metadata = endpointBuilder.Metadata.First(m => m.GetType() == typeof(BffRemoteApiEndpointMetadata)) as BffRemoteApiEndpointMetadata; metadata.BffUserAccessTokenParameters = bffUserAccessTokenParameters; }); return(builder); }
/// <summary> /// Allows for setting a UserAccessTokenParameter /// </summary> /// <param name="builder"></param> /// <param name="bffUserAccessTokenParameters"></param> /// <typeparam name="TBuilder"></typeparam> /// <returns></returns> public static TBuilder WithUserAccessTokenParameter <TBuilder>(this TBuilder builder, BffUserAccessTokenParameters bffUserAccessTokenParameters) where TBuilder : IEndpointConventionBuilder { builder.Add(endpointBuilder => { var metadata = endpointBuilder.Metadata.First(m => m.GetType() == typeof(BffRemoteApiEndpointMetadata)) as BffRemoteApiEndpointMetadata; if (metadata == null) { throw new InvalidOperationException("no metadata found"); } metadata.BffUserAccessTokenParameters = bffUserAccessTokenParameters; }); return(builder); }