public async Task <TResult> CreateAsync <TResult>(Guid authenticationRequestId, EastFive.Api.Azure.Credentials.CredentialValidationMethodTypes method, AuthenticationActions action, Guid actorLinkId, string token, Uri redirectUrl, Uri redirectLogoutUrl, Func <TResult> onSuccess, Func <TResult> onAlreadyExists) { var doc = new Documents.AuthenticationRequestDocument { Method = Enum.GetName(typeof(EastFive.Api.Azure.Credentials.CredentialValidationMethodTypes), method), Action = Enum.GetName(typeof(AuthenticationActions), action), LinkedAuthenticationId = actorLinkId, Token = token, RedirectUrl = redirectUrl.IsDefault() ? default(string) : redirectUrl.AbsoluteUri, RedirectLogoutUrl = redirectLogoutUrl.IsDefault() ? default(string) : redirectLogoutUrl.AbsoluteUri, }; return(await this.repository.CreateAsync(authenticationRequestId, doc, () => onSuccess(), () => onAlreadyExists())); }
public static async Task <TResult> CredentialPostAsync <TResult>(this ITestSession session, EastFive.Api.Azure.Credentials.CredentialValidationMethodTypes method, string subject, Guid authentication, Func <HttpResponseMessage, Credential, TResult> callback) { //Create the order via post var resource = new Credential() { Id = Guid.NewGuid(), Authentication = authentication, Method = method, Subject = subject, }; var response = await session.PostAsync <EastFive.Api.Azure.Credentials.Controllers.CredentialController>(resource); return(callback(response, resource)); }