Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix license link and add badges #1

Merged
merged 6 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Will be autogenerated on next release
65 changes: 41 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,62 @@
## Description
# Nest Auth Client

Client implementation for the EVVA [Auth Service].
[![NPM Version](https://img.shields.io/npm/v/%40evva%2Fnest-auth-client)](https://www.npmjs.com/package/@evva/nest-auth-client)
[![NPM Downloads](https://img.shields.io/npm/dy/%40evva%2Fnest-auth-client)](https://www.npmjs.com/package/@evva/nest-auth-client)
![NPM Unpacked Size (with version)](https://img.shields.io/npm/unpacked-size/%40evva%2Fnest-auth-client/latest)
![GitHub last commit](https://img.shields.io/github/last-commit/evva-sfw/nest-auth-client)
[![GitHub branch check runs](https://img.shields.io/github/check-runs/evva-sfw/nest-auth-client/main)]([URL](https://github.com/evva-sfw/nest-auth-client/actions))
[![EVVA License](https://img.shields.io/badge/license-EVVA_License-yellow.svg?color=fce500&logo=data:image/svg+xml;base64,PCEtLSBHZW5lcmF0ZWQgYnkgSWNvTW9vbi5pbyAtLT4KPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjY0MCIgaGVpZ2h0PSIxMDI0IiB2aWV3Qm94PSIwIDAgNjQwIDEwMjQiPgo8ZyBpZD0iaWNvbW9vbi1pZ25vcmUiPgo8L2c+CjxwYXRoIGZpbGw9IiNmY2U1MDAiIGQ9Ik02MjIuNDIzIDUxMS40NDhsLTMzMS43NDYtNDY0LjU1MmgtMjg4LjE1N2wzMjkuODI1IDQ2NC41NTItMzI5LjgyNSA0NjYuNjY0aDI3NS42MTJ6Ij48L3BhdGg+Cjwvc3ZnPgo=)](LICENSE)

## Build & Package
```bash
# Nest Build
$ nest build
```
Client implementation for the EVVA Auth Service.

## Install

`npm i @evva/nest-auth-client`

## Usage

```
import {ConfigService } from '@nestjs/config';
import {
AuthClientModule,
AuthClientService,
AuthClientOptions,
AUTH_ENDPOINT,
AUTH_TENANT,
```ts
import { ConfigModule, ConfigService } from '@nestjs/config';
import {
AUTH_CLIENT,
AUTH_ENDPOINT,
AUTH_SECRET,
AUTH_TENANT,
AUTH_VALIDITY,
VAULT_JWTROLE_IDENTIFIER,
VAULT_ENDPOINT,
AuthClientModule,
AuthClientModuleOptions,
VAULT_CA,
VAULT_ENDPOINT,
VAULT_JWTROLE_IDENTIFIER,
} from '@evva/nest-auth-client';

AuthClientModule.forRootAsync({
@Module({
imports: [
AuthClientModule.forRootAsync({
imports: [ConfigModule],
inject: [ConfigService],
useFactory: async (configService: ConfigService) =>
useFactory: async (configService: ConfigService) =>
({
authEndpoint: configService.get<string>(AUTH_ENDPOINT), //use optional
authTenant: configService.get<string>(AUTH_TENANT),
authClientId: configService.get<string>(AUTH_CLIENT),
authClientSecret: configService.get<string>(AUTH_SECRET),
authValidity: parseInt(configService.get(AUTH_VALIDITY)), // in seconds, see spec
vaultRoleId: configService.get<string>(AULT_JWTROLE_IDENTIFIER),
vaultRoleId: configService.get<string>(VAULT_JWTROLE_IDENTIFIER),
vaultEndpoint: configService.get<string>(VAULT_ENDPOINT),
vaultCA: configService.get<string>(VAULT_CA)
}) as AuthClientOptions,
vaultCA: configService.get<string>(VAULT_CA),
}) as AuthClientModuleOptions,
}),
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}
```

When using the ConfigService, make sure that the variables are loaded before accessing them.
This usually works as follows:
```
```ts
export class MyModule implements OnModuleInit {


Expand All @@ -55,10 +66,16 @@ export class MyModule implements OnModuleInit {
}
```

## Build & Package
```bash
# Nest Build
$ nest build
```

## Support

## Stay in touch

## License

Proprietary
[Proprietary](LICENSE)
Loading