Base solution for your next web application
Open Closed

System Feature #12704


User avatar
0
WirelessDynamics created

Hi All,

Does ASPNET Zero Support ther following and how:

Does it support integration with Single Sign-On (SSO)? Does the system support user attributes synchronization with Active Directory or other identity providers such as email , username and title? Can the solution be integrated with an Audit Logger system for activity monitoring and logging such as syslog?

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

1 Answer(s)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @WirelessDynamics

    Thank you for your questions. In short: yes to all three. SSO and audit logging are built in. Attribute sync is built in for Active Directory, and partly built in for other identity providers. Details below.

    1. Single Sign-On (SSO)

    ASP.NET Zero connects to your existing identity provider out of the box. Supported protocols:

    • OpenID Connect: Microsoft Entra ID (Azure AD), Okta, Auth0, Keycloak, Ping Identity, AD FS, Google Workspace or any standards-compliant provider. The default is the Authorization Code flow with PKCE.
    • WS-Federation: AD FS and Entra ID.
    • Active Directory / LDAP: users sign in with their domain username and password, which are validated against your domain controller.
    • Social logins: Google, Microsoft, Facebook and Twitter (X).

    Providers are configured in appsettings.json: client ID, secret, authority, response type and claims mapping. In multi-tenant deployments you can set Authentication:AllowSocialLoginSettingsPerTenant to true. Each tenant then configures its own identity provider from the Settings page, with no redeployment.

    When someone signs in through an external provider for the first time, ASP.NET Zero creates a local account for them automatically (just-in-time provisioning) and assigns the default roles. Existing users can also link external logins to their account under My Settings > External Logins.

    ASP.NET Zero can also be the identity provider. Its built-in OpenIddict integration turns it into an OAuth 2.0 / OpenID Connect server, so your other applications can use it for SSO.

    Not included out of the box:

    • SAML 2.0. Most SAML identity providers (Entra ID, Okta, AD FS, Keycloak) also offer OpenID Connect for the same directory, and that is the recommended route. If SAML is a hard requirement, you can add a handler such as Sustainsys.Saml2 or ITfoxtec.Identity.Saml2 as an extra external login provider. That is custom development.
    • Windows Integrated Authentication (Kerberos, no password prompt). For seamless desktop SSO, use AD FS or Entra ID through OpenID Connect or WS-Federation. Both support it on their side.

    Documentation:

    • External logins: https://docs.aspnetzero.com/aspnet-core-angular/latest/Features-Angular-Social-Logins
    • Account linking: https://docs.aspnetzero.com/aspnet-core-angular/latest/Features-Angular-Social-Account-Linking
    • OpenIddict (ASP.NET Zero as identity provider): https://docs.aspnetzero.com/aspnet-core-angular/latest/Infrastructure-Core-Angular-OpenIddict-Integration

    2. User attribute synchronization

    How this works depends on the integration.

    Active Directory (LDAP): built in
    • At first login, the user is created from AD with these values: username (sAMAccountName or UPN), first name (givenName), last name (sn), email (mail) and enabled/disabled status.
    • On every later login, these values are refreshed from AD. A user disabled in AD can no longer sign in.
    • You enable it with one line in the Core module. LDAP settings (domain, service account, SSL) are then managed from the Settings page, and the password is stored encrypted.
    • To sync more attributes (title, department, phone, or AD groups mapped to roles), override one method, UpdateUserFromPrincipal, in AppLdapAuthenticationSource.
    • Note: the built-in LDAP integration uses System.DirectoryServices.AccountManagement, which needs a Windows host. On Linux or containers, use OpenID Connect, or write a custom authentication source on a cross-platform LDAP library such as System.DirectoryServices.Protocols.
    OpenID Connect / WS-Federation (Entra ID, Okta, AD FS…)
    • With claims mapping you choose which provider claims fill the user fields. Username, first name, last name and email are read from the token.
    • Out of the box, these values are set when the account is created. They are not refreshed on later logins. Refreshing them on each login is a small change in the external login flow (TokenAuthController, or AccountController for MVC).
    • IExternalLoginInfoManager lets you customize, per provider, how the username and name are taken from the claims.
    Title and other custom fields
    • The User entity has no Title field by default. You have two options:
      • Dynamic Entity Properties (built in, and the User entity is already registered): an administrator defines a "Title" property in the UI. No database schema change is needed.
      • Add a Title property to the User entity with an EF Core migration.
    • Either way, the same sync code fills it from the LDAP title attribute or the jobTitle claim.
    Background sync / SCIM
    • Built-in sync happens when the user signs in. Scheduled background sync (updating or deactivating users who don't sign in) and SCIM 2.0 provisioning endpoints are not included. You can add either one: a background worker that reads AD or Microsoft Graph on a schedule, or SCIM endpoints for provisioning from Entra ID or Okta.

    Documentation: https://docs.aspnetzero.com/aspnet-core-angular/latest/Features-Angular-Active-Directory

    3. Audit logging and syslog integration

    Built in

    Everything below is stored in the database and shown under Administration > Audit Logs:

    • Operation logs. Every application service and API/controller call is logged automatically, with:

      • user, tenant and impersonator
      • service and method name, and parameters
      • execution time and duration
      • client IP and browser
      • the exception, if one was thrown

      Sensitive fields such as passwords are left out with [DisableAuditing].

    • Entity change history. For the entities you choose to track: who changed which property, from what value to what value, and when.

    • Login attempts. Successful and failed sign-ins, with IP address, browser and result.

    • In the UI you can filter and export to Excel. Old logs can be deleted automatically, with an optional Excel backup.

    Sending to syslog or a SIEM

    Application logs. ASP.NET Zero logs through log4net, and log4net's built-in RemoteSyslogAppender sends logs to a syslog server (UDP, RFC 3164). This only needs a change in log4net.config.

    Audit logs. Replace IAuditingStore with your own store. It keeps saving to the database and also forwards each record to syslog, or to Splunk HEC, Elastic, Graylog, Azure Monitor and so on. The same approach works for entity changes (IEntityHistoryStore) and login attempts.

    public class SyslogAuditingStore : AuditingStore
    {
        private readonly ILogger _auditLogger;
    
        public SyslogAuditingStore(IRepository<AuditLog, long> auditLogRepository, ILoggerFactory loggerFactory)
            : base(auditLogRepository)
        {
            _auditLogger = loggerFactory.Create("AuditLog");
        }
    
        public override async Task SaveAsync(AuditInfo auditInfo)
        {
            await base.SaveAsync(auditInfo);
            Forward(auditInfo);
        }
    
        public override void Save(AuditInfo auditInfo)
        {
            base.Save(auditInfo);
            Forward(auditInfo);
        }
    
        private void Forward(AuditInfo auditInfo)
        {
            _auditLogger.Info(new
            {
                auditInfo.TenantId,
                auditInfo.UserId,
                auditInfo.ImpersonatorUserId,
                auditInfo.ServiceName,
                auditInfo.MethodName,
                auditInfo.Parameters,
                auditInfo.ExecutionTime,
                auditInfo.ExecutionDuration,
                auditInfo.ClientIpAddress,
                auditInfo.BrowserInfo,
                Exception = auditInfo.Exception?.Message
            }.ToJsonString());
        }
    }
    

    Register it in the Core module's PreInitialize:

    Configuration.ReplaceService<IAuditingStore, SyslogAuditingStore>(DependencyLifeStyle.Transient);
    

    Then send the AuditLog logger to your syslog server in log4net.config:

    <appender name="Syslog" type="log4net.Appender.RemoteSyslogAppender">
      <remoteAddress value="10.0.0.5" />
      <remotePort value="514" />
      <identity value="AspNetZero" />
      <facility value="Local0" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%message" />
      </layout>
    </appender>
    <logger name="AuditLog" additivity="false">
      <level value="INFO" />
      <appender-ref ref="Syslog" />
    </logger>
    

    If you need syslog over TCP/TLS (RFC 5424) or a vendor API, call that client library from the same Forward method instead.

    No-code option. Your SIEM agent can collect directly from the audit tables (AbpAuditLogs, AbpEntityChanges, AbpUserLoginAttempts) or from the log files.

    Documentation:

    • Audit logs: https://docs.aspnetzero.com/aspnet-core-angular/latest/Features-Angular-Audit-Logs
    • Entity history: https://docs.aspnetzero.com/aspnet-core-angular/latest/Features-Angular-Entity-History
    • Auditing infrastructure (ABP): https://aspnetboilerplate.com/Pages/Documents/Audit-Logging

    Best regards,

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)