internal Task <Uri> GetLogoutUrlAsync(IAuthApplication application, IProvideUrl urlHelper, Guid authorizationIdSecure) { var authenticationId = this.id; return(GetLoginProviderAsync(application, (name, loginProvider) => { var redirectionResource = loginProvider.CallbackController; var redirectionLocation = urlHelper.GetLocation(redirectionResource); return loginProvider.GetLogoutUrl(authorizationIdSecure, redirectionLocation, type => urlHelper.GetLocation(type)); }, () => throw new Exception($"Login provider with id {authenticationId} does not exists."))); }
public static Uri GetLocation <TResource>(this IProvideUrl url, Expression <Action <TResource> >[] parameters, IApiApplication application, string routeName = "DefaultApi") { var baseUrl = url.GetLocation(typeof(TResource), routeName); return(baseUrl.SetParameters(parameters, application, routeName: routeName)); }
public static Uri GetLocation <TResource>(this IProvideUrl url, Expression <Action <TResource> > param1, IApiApplication application, string routeName = "DefaultApi") { return(url.GetLocation( new Expression <Action <TResource> >[] { param1 }, application, routeName)); }
public static Uri GetLocation <TController>(this IProvideUrl url, Guid?idMaybe, string routeName = default(string)) { if (idMaybe.HasValue) { return(url.GetLocation <TController>(idMaybe.Value, routeName)); } return(default(Uri)); }
public static async Task <IHttpResponse> GetAsync( //[WorkflowNewId] //[WorkflowVariable( // Workflows.PasswordLoginCreateAccount.Variables.State, // AuthorizationPropertyName)] [OptionalQueryParameter(Name = AuthorizationPropertyName)] IRefOptional <Authorization> authorizationRefOptional, [WorkflowParameter( Value = "d989b604-1e25-4d77-b79e-fe1c7d36f833", Description = "Unique and static to each client (i.e. iOS or Web)")] [QueryParameter(Name = ClientPropertyName)] IRef <Client> clientRef, [WorkflowNewId(Description = "No idea what this does.")] [OptionalQueryParameter(Name = ValidationPropertyName)] string validation, IAuthApplication application, IProvideUrl urlHelper, //ContentTypeResponse<Authentication> onFound, [WorkflowVariable( Workflows.PasswordLoginCreateAccount.Variables.Authorization, Authentication.AuthenticationPropertyName)] [WorkflowVariableRedirectUrl( VariableName = Workflows.PasswordLoginCreateAccount.Variables.AuthorizationRedirect)] RedirectResponse onFound, ReferencedDocumentNotFoundResponse <Client> onInvalidClient) { return(await await clientRef.StorageGetAsync( (client) => { var authentication = new Authentication { authenticationRef = SecureGuid.Generate().AsRef <Authentication>(), authorizationMaybe = authorizationRefOptional, client = clientRef, }; return authentication.StorageCreateAsync( (entity) => { var location = urlHelper.GetLocation <Authentication>( auth => auth.authenticationRef.AssignQueryValue(authentication.authenticationRef), application); return onFound(location); }); }, () => onInvalidClient().AsTask())); }
public static IHttpResponse PostLogin( Guid authenticationId, HttpApplication application, IProvideUrl urlHelper, RedirectResponse onRedirect, GeneralFailureResponse onFailure) { return(EastFive.Security.RSA.RSAFromConfig(EastFive.Azure.AppSettings.AdminLoginRsaKey, rsa => { using (rsa) { var authenticationIdBytes = authenticationId.ToByteArray(); var signedBytes = rsa.SignData(authenticationIdBytes, CryptoConfig.MapNameToOID("SHA512")); var redirectUrl = urlHelper.GetLocation <AdminLoginRedirection>( adminLoginRedir => adminLoginRedir.authenticationId.AssignQueryValue(authenticationId), adminLoginRedir => adminLoginRedir.token.AssignQueryValue(signedBytes), application); return onRedirect(redirectUrl); } }, () => onFailure("missing config setting"), (why) => onFailure(why))); }
public static Uri GetLocation <TController>(this IProvideUrl url, Guid id, string routeName = default(string)) { return(url.GetLocation(typeof(TController), id, routeName)); }
public static Uri GetLocation <TController>(this IProvideUrl url, string routeName = "DefaultApi") { return(url.GetLocation(typeof(TController), routeName: routeName)); }