Socket
Book a DemoInstallSign in
Socket

@tilde-nlp/ngx-user-access

Package Overview
Dependencies
Maintainers
5
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tilde-nlp/ngx-user-access

This library is designed to include shared user access services, such as Authentication, Permissions, and Keycloak. Here, we store all the user-related resources used across different projects.

latest
npmnpm
Version
8.0.6
Version published
Maintainers
5
Created
Source

NgxUserAccess

This library is designed to include shared user access services, such as Authentication, Permissions, and Keycloak. Here, we store all the user-related resources used across different projects.

Implementation

To integrate this library into your project, add @tilde-nlp/ngx-user-access to your dependencies.

  • Review the UserAccessConfig interface and supply the required fields in the configuration token USER_ACCESS_CONFIG_TOKEN.

  • To configure custom user permissions you should provide UserConfigurationService in your application.

  • The KEYCLOAK_PROVIDER should be provided in each app config, but only after you've set up USER_ACCESS_CONFIG_TOKEN.

Required configuration example below:

` class AppUserCustomConfigurationService implements UserCustomConfiguration { updateUserConfiguration(currentConfiguration: UserConfiguration, newConfiguration: UserConfiguration): UserConfiguration { let configuration: UserConfiguration = {};

	return configuration;
}

}

function USER_CUSTOM_CONFIGURATION_SERVICE_PROVIDER() { return { provide: UserConfigurationService, useClass: AppUserCustomConfigurationService }; }

function USER_ACCESS_CONFIG_PROVIDER() { return { provide: USER_ACCESS_CONFIG_TOKEN, useFactory: (configService: ConfigurationService): UserAccessConfig => { const config = configService.configuration;

		// kc token makes strapi return 401, so no need to send it to strapi.
		if (!config?.strapi?.disabled) {
			EXCLUDE_AUTH_HEADERS_URLS.push(config.strapi!.url!);
		}

		return {
			keycloak: { ...config.auth.keycloak!, bearerExcludedUrls: EXCLUDE_AUTH_HEADERS_URLS },
			plans: Object.values([]),
			subscriptions: config.subscription,
			alwaysAuth: config.auth.alwaysAuth
		};
	},
	deps: [ConfigurationService]
};

const USER_ACCESS_PROVIDERS: Provider[] = [USER_ACCESS_CONFIG_PROVIDER(), USER_CUSTOM_CONFIGURATION_SERVICE_PROVIDER()];

providers: [ KeycloakService, USER_ACCESS_PROVIDERS, provideAppInitializer(async () => { return await KEYCLOAK_PROVIDER() }), ] `

FAQs

Package last updated on 03 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts