Skip to content

Commit

Permalink
Merge pull request #85 from emeraudeframework/dev
Browse files Browse the repository at this point in the history
Refactoring
  • Loading branch information
gsk567 committed Jan 4, 2022
2 parents e9340d1 + fa6a625 commit 04b5790
Show file tree
Hide file tree
Showing 18 changed files with 164 additions and 37 deletions.
1 change: 1 addition & 0 deletions Emeraude.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ProjectSection(SolutionItems) = preProject
appveyor.yml = appveyor.yml
.github\workflows\dotnet-core.yml = .github\workflows\dotnet-core.yml
Emeraude.ruleset = Emeraude.ruleset
README.md = README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Emeraude", "src\Emeraude\Emeraude.csproj", "{EBD0BDA8-0B66-4D8E-9151-65E55857A549}"
Expand Down
138 changes: 137 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,137 @@
# Emeraude Framework
<img align="left" width="300px" style="background-color:white;" title="Emeraude" alt="Emeraude" src="https://raw.githubusercontent.com/emeraudeframework/emeraude/master/art/logo_text.svg" />

<br/>

# Emeraude Framework
### A lightweight ASP.NET framework for creating successful products

![.NET Core](https://github.com/emeraudeframework/emeraude/workflows/.NET%20Core/badge.svg)
[![Build status](https://ci.appveyor.com/api/projects/status/8mkn54s6fauem0lb?svg=true)](https://ci.appveyor.com/project/gsk567/emeraude)
![Nuget](https://img.shields.io/nuget/v/Emeraude)

---

### For detailed explanation please check our [DOCUMENTATION](https://emeraude.dev)

---

Emeraude is a web application framework based on ASP.NET which is delivered in the form of NuGet packages
that anyone can import into the project that working on. The framework can be considered as separated and
relatively independent because its main goal is to provide additional features by minor impact over the
application.
For a more clear view of the framework let's describe what Emeraude is/does and what Emeraude is/does not:

- Emeraude is based on ASP.NET
- Emeraude is written on .NET 6 and C# 10
- Emeraude is a framework - not a library
- Emeraude is a wrapper for an ASP.NET-based web application
- Emeraude can be used for all type web projects - MVC, Web API, RazorPages, Blazor, etc.
- Emeraude provides abstractions, services and utilities out of the box
- Emeraude is configurable
- Emeraude is free and open-source
- Emeraude does not require any licenses and keys to work
- Emeraude does not have any requirements for your application code
- Emeraude does not wrap any UI-related elements (HTML, CSS, JS) into its NuGet packages
- Emeraude is not a CMS, CRM, etc.
- Emeraude is not SaaS, PaaS, etc.

## Features

Emeraude Framework is following the principle 'Less is More' so the list of the features is significantly small:

#### EmPages

EmPage (Emeraude Page) is the core feature of the framework. Its purpose is to provide to the Emeraude users ability to
create complete feature of any kind with minimal effort. EmPage can be considered as sub feature of the administration
part of the framework because from management point of view the framework is design to provide powerful, private and
secure solution for control of internal and external data flows.

#### Runtime Generation

In order to provide maximum productivity to the developers Emeraude has built-in tool called **Client Builder**.
The tool is constructed by 2 main elements - back-end element represented by Scaffold Modules and front-end element
represented by the Emeraude Portal.

#### Authentication

Authentication is split on two - integrated authentication which is a part of the Portal Gateway or pluggable authentication
which is a part of the Platform Base. Both are consuming the Identity instance of the Application layer.

#### Localization

Localization is a main feature of the framework that is useful if you're considering to use Emeraude as a core base of
your application. The feature itself is split on few parts - one core that is placed in the infrastructure and another
consumable in the presentation. Everything related to the localization is stored in separated SQLite database and managed
by the LocalizationContext. By using the Client Builder module of Emeraude Portal you have management capabilities for the
LocalizationContext.

#### System Files Management

In order to simplify the usage with files of the application folder Emeraude Framework provides separate instance of the
infrastructure designed to fit the requirements of the system file management.

#### SEO

Search Engine Optimization cannot be provided as a feature because it is a result of hard work during the development of
any application. But to help you during the development of your application Emeraude provides you sitemap generator and
easy way to generate friendly localized URLs.

#### Utilities

We know that during development of any application sometimes developers needs utilities for boosting the performance and
making the code cleaner. Emeraude Framework in addition to the context based features provides static utility classes and
methods by referencing the **Emeraude.Essentials**. That assembly is mainly used by the framework itself, but you can use
it if you see it useful.

## Emeraude Portal

Emeraude Portal is separated product maintained by the Emeraude team. Its idea is to provide ready to use client that
is deployed separately of your application and consume the Portal Gateway of your application. Our main purpose is instead to
provide you integrated client transported with the packages or separated desktop application that you need to install on
your machine, just to link your application with the portal that is accessible on [emeraude.io](https://emeraude.io).
More about the Emeraude Portal can be found on the [emeraude.io](https://emeraude.io).

## Business Applications

The proper usage of the Emeraude is very important for the stability of your application and respectively product.
The framework is designed to provide management capabilities and supporting abstractions, services, and utilities
for your application.

Consider the fact Emeraude Portal is made to support you, your team members, and the stakeholders - not the users of
the application.

The usage of the Emeraude is not limited to a specific domain. A few possible examples are:

- Website
- Web application
- Web API
- CMS, CRM, ERP
- Mobile/desktop application data/users manager
- Microservices data manager
- Unified third-parties manager
- Source code analysis platform

## Sponsors

<div class="sponsors-list-item" style="background: white">
<a class="feature-list-item m-3" style="display: inline-block;" title="JetBrains" target="_blank" href="https://www.jetbrains.com/?from=Emeraude" data-v-94bffd70="">
<img src="https://emeraude.dev/_assets/images/sponsors/jetbrains.svg" alt="JetBrains" data-v-94bffd70="">
</a>
<a class="feature-list-item m-3" style="display: inline-block;" title="Netlify" target="_blank" href="https://www.netlify.com/?reference=emeraude.dev" data-v-94bffd70="">
<img src="https://emeraude.dev/_assets/images/sponsors/netlify.svg" alt="Netlify" data-v-94bffd70="">
</a>
</div>

## Support Us

<div id="support" data-v-6ad604c2="" data-v-3cfc6c66="">
<div class="donate-section" data-v-3cfc6c66="">
<a href="https://www.paypal.com/donate?hosted_button_id=4FEAXAP5TL3EG" class="btn btn-lg btn-outline-light mx-1"
target="_blank" data-v-3cfc6c66="">Donate via PayPal</a>
<br />
<a href="https://www.patreon.com/gsk567" class="btn btn-lg btn-outline-light mx-1" target="_blank"
data-v-3cfc6c66="">Become a backer or sponsor via Patreon</a>
</div>
</div>

<p class="my-4 px-2"> Apache License 2.0 • Copyright © 2022 <a href="https://georgi.karagogov.com/" target="_blank">Georgi Karagogov</a></p>
4 changes: 4 additions & 0 deletions src/Emeraude.Defaults/Emeraude.Defaults.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,9 @@
<ProjectReference Include="..\Emeraude.Application.Admin.EmPages\Emeraude.Application.Admin.EmPages.csproj" />
<ProjectReference Include="..\Emeraude\Emeraude.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Identity\ExternalProviders" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
using System.Net.Http;
using System.Security.Claims;
using System.Threading.Tasks;
using Emeraude.Essentials.Base;
using Emeraude.Infrastructure.Identity.Common;
using Emeraude.Infrastructure.Identity.ExternalProviders;
using Emeraude.Infrastructure.Identity.Services;
using IdentityServer4;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.OAuth;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;

namespace Emeraude.Infrastructure.Identity.ExternalProviders.Facebook;
namespace Emeraude.Defaults.Identity.ExternalProviders.Facebook;

/// <summary>
/// Facebook authenticator for external authentication.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Emeraude.Infrastructure.Identity.Services;
using Newtonsoft.Json;

namespace Emeraude.Infrastructure.Identity.ExternalProviders.Facebook;
namespace Emeraude.Defaults.Identity.ExternalProviders.Facebook;

/// <summary>
/// Facebook external user implementation.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Newtonsoft.Json;

namespace Emeraude.Infrastructure.Identity.ExternalProviders.Facebook;
namespace Emeraude.Defaults.Identity.ExternalProviders.Facebook;

/// <summary>
/// Helper class for mapping Facebook profile picture.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Newtonsoft.Json;

namespace Emeraude.Infrastructure.Identity.ExternalProviders.Facebook;
namespace Emeraude.Defaults.Identity.ExternalProviders.Facebook;

/// <summary>
/// Helper class for mapping Facebook profile picture data.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
using System.Net.Http.Headers;
using System.Security.Claims;
using System.Threading.Tasks;
using Emeraude.Essentials.Base;
using Emeraude.Infrastructure.Identity.Common;
using Emeraude.Infrastructure.Identity.ExternalProviders;
using Emeraude.Infrastructure.Identity.Services;
using IdentityServer4;
using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;

namespace Emeraude.Infrastructure.Identity.ExternalProviders.Google;
namespace Emeraude.Defaults.Identity.ExternalProviders.Google;

/// <summary>
/// Google authenticator for external authentication.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Emeraude.Infrastructure.Identity.Services;
using Newtonsoft.Json;

namespace Emeraude.Infrastructure.Identity.ExternalProviders.Google;
namespace Emeraude.Defaults.Identity.ExternalProviders.Google;

/// <summary>
/// Google external user implementation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ public EmIdentityOptions()
this.SetDefaults();
}

/// <summary>
/// Flag that indicates whether to be registered external authentication from the settings.
/// </summary>
public bool HasExternalAuthentication { get; set; }

/// <summary>
/// Dictionary that contains all additional roles and their claims.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Emeraude.Presentation.PlatformBase.Controllers;
/// <summary>
/// Execution result abstract controller.
/// </summary>
public abstract class ExecutionResultController : PublicController
public abstract class ExecutionResultController : EmPublicController
{
private const string ResultRoute = "/execution/result";
private const string HandleRoute = "/execution/handle";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Emeraude.Presentation.PlatformBase.Controllers;
/// <summary>
/// User authentication controller.
/// </summary>
public abstract partial class UserAuthenticationController : PublicController
public abstract partial class UserAuthenticationController : EmPublicController
{
private const string LogoutRoute = "/logout";

Expand Down Expand Up @@ -102,11 +102,12 @@ protected virtual async Task SignInAsync(IUser user)
this.AuthenticationProperties);
}

private IActionResult RedirectToDefault()
/// <summary>
/// Redirect to default action provider.
/// </summary>
/// <returns></returns>
protected virtual IActionResult RedirectToDefault()
{
var redirectCallback = this.OptionsProvider.GetPresentationOptions().AuthenticationDefaultRedirectCallback;
return redirectCallback != null
? redirectCallback.Invoke(this.HttpContext)
: this.LocalRedirect("/");
return this.LocalRedirect("/");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ public abstract partial class UserAuthenticationController
[ValidateAntiForgeryToken]
public virtual IActionResult ExternalLogin([FromForm(Name = "externalProvider")]string externalProvider, string returnUrl = "")
{
if (!this.OptionsProvider.GetIdentityOptions().HasExternalAuthentication)
{
return this.NotFound();
}

if (this.IsAuthenticated)
{
return this.RedirectToDefault();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Emeraude.Presentation.PlatformBase.Controllers;
/// Client controller for MVC user management.
/// </summary>
[Authorize(AuthenticationSchemes = EmAuthenticationDefaults.CookieAuthenticationScheme)]
public abstract class UserManagementController : PublicController
public abstract class UserManagementController : EmPublicController
{
private const string ChangeEmailRoute = "/confirm-change-email";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static class ControllerExtensions
/// <param name="reference"></param>
/// <returns></returns>
public static async Task<IActionResult> RedirectToExecutionResultAsync(
this PublicController controller,
this EmPublicController controller,
bool succeeded,
string successTitle,
string failedTitle,
Expand All @@ -47,7 +47,7 @@ public static class ControllerExtensions
/// <param name="reference"></param>
/// <returns></returns>
public static async Task<IActionResult> RedirectToSucceededExecutionResultAsync(
this PublicController controller,
this EmPublicController controller,
string title,
string message,
string reference)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
namespace Emeraude.Presentation.Controllers;

/// <summary>
/// Abstraction for controllers which will be used on the client side of the application (not for the administration).
/// Abstraction for controllers which will be used on the customer side of the application.
/// </summary>
[ApiExplorerSettings(IgnoreApi = true)]
public abstract class PublicController : EmController
public abstract class EmPublicController : EmController
{
private const string LanguageCookieName = ".Emeraude.Language";

Expand Down
2 changes: 1 addition & 1 deletion src/Emeraude.Presentation/Controllers/ErrorController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Emeraude.Presentation.Controllers;
/// <summary>
/// Generic error controller which is triggered by the error interceptor.
/// </summary>
public sealed class ErrorController : PublicController
public sealed class ErrorController : EmPublicController
{
/// <summary>
/// Error index action that returns a status code result if there no defined error view or the view placed on 'Views/Client/Error/Index.cshtml'.
Expand Down
5 changes: 0 additions & 5 deletions src/Emeraude.Presentation/Options/EmPresentationOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ public EmPresentationOptions()
this.FeatureProviders = new List<IApplicationFeatureProvider>();
}

/// <summary>
/// Default redirect function that compute the action result redirection after login. If callback is null redirection will be executed to Index of HomeController if exists.
/// </summary>
public Func<HttpContext, IActionResult> AuthenticationDefaultRedirectCallback { get; set; }

/// <summary>
/// List of additional feature providers for extending the MVC configuration.
/// </summary>
Expand Down

0 comments on commit 04b5790

Please sign in to comment.