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

build: pnpm #2

Merged
merged 2 commits into from
Aug 6, 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
51 changes: 33 additions & 18 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,23 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
run_install: false

- name: Cache dependencies
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20.9.0
cache: 'yarn'
cache-dependency-path: 'yarn.lock'
cache: 'pnpm'
cache-dependency-path: 'pnpm-lock.yaml'

- name: yarn install
run: yarn install --immutable
- name: pnpm install
run: pnpm install --frozen-lockfile

- name: Run tests
run: yarn run lint:export
run: pnpm run lint:export
continue-on-error: true

- name: Annotate Code Linting Results
Expand All @@ -63,18 +68,23 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
run_install: false

- name: Cache dependencies
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20.9.0
cache: 'yarn'
cache-dependency-path: 'yarn.lock'
cache: 'pnpm'
cache-dependency-path: 'pnpm-lock.yaml'

- name: yarn install
run: yarn install --immutable
- name: pnpm install
run: pnpm install --frozen-lockfile

- name: Run tests
run: yarn run lint:formatting
run: pnpm run lint:formatting

typecheck:
name: Type Checking
Expand All @@ -83,15 +93,20 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
run_install: false

- name: Cache dependencies
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20.9.0
cache: 'yarn'
cache-dependency-path: 'yarn.lock'
cache: 'pnpm'
cache-dependency-path: 'pnpm-lock.yaml'

- name: yarn install
run: yarn install --immutable
- name: pnpm install
run: pnpm install --frozen-lockfile

- name: Run tests
run: yarn run type-check
run: pnpm run type-check
42 changes: 14 additions & 28 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,100 +4,86 @@ All notable changes to this project will be documented in this file. See [commit

## [0.0.18](https://github.com/thechristophe/web-oidc-client/compare/v0.0.17...v0.0.18) (2024-05-17)


### Features

* **AuthClient:** renew function ([e62c39c](https://github.com/thechristophe/web-oidc-client/commit/e62c39c6a2c791ed2400364a5354c8c7226401fa))
- **AuthClient:** renew function ([e62c39c](https://github.com/thechristophe/web-oidc-client/commit/e62c39c6a2c791ed2400364a5354c8c7226401fa))

## [0.0.17](https://github.com/thechristophe/web-oidc-client/compare/v0.0.16...v0.0.17) (2024-05-01)


### Bug Fixes

* **AuthClient:** publish new status event if token has changed ([42a5eb2](https://github.com/thechristophe/web-oidc-client/commit/42a5eb21291a0f41924eaec01a3edc94d7eb48fb))
- **AuthClient:** publish new status event if token has changed ([42a5eb2](https://github.com/thechristophe/web-oidc-client/commit/42a5eb21291a0f41924eaec01a3edc94d7eb48fb))

## [0.0.16](https://github.com/thechristophe/web-oidc-client/compare/v0.0.15...v0.0.16) (2024-03-29)


### Bug Fixes

* only process redirects if we're expecting one ([730f39b](https://github.com/thechristophe/web-oidc-client/commit/730f39b7f898e332d02df940009a821932e7feb3))
- only process redirects if we're expecting one ([730f39b](https://github.com/thechristophe/web-oidc-client/commit/730f39b7f898e332d02df940009a821932e7feb3))

## [0.0.15](https://github.com/thechristophe/web-oidc-client/compare/v0.0.14...v0.0.15) (2024-03-27)


### Bug Fixes

* replace session with localStorage due to odd issues ([2fea775](https://github.com/thechristophe/web-oidc-client/commit/2fea775dfddf3ef884a711f50c37449c37791a60))
- replace session with localStorage due to odd issues ([2fea775](https://github.com/thechristophe/web-oidc-client/commit/2fea775dfddf3ef884a711f50c37449c37791a60))

## [0.0.14](https://github.com/thechristophe/web-oidc-client/compare/v0.0.13...v0.0.14) (2024-03-27)


### Bug Fixes

* error state printing [Object object] ([339a2b0](https://github.com/thechristophe/web-oidc-client/commit/339a2b0c4a519d2c2a931c837ec5eebfda22e8d8))
- error state printing [Object object] ([339a2b0](https://github.com/thechristophe/web-oidc-client/commit/339a2b0c4a519d2c2a931c837ec5eebfda22e8d8))

## [0.0.13](https://github.com/thechristophe/web-oidc-client/compare/v0.0.12...v0.0.13) (2024-03-25)


### Bug Fixes

* more explicit warn logs ([442aded](https://github.com/thechristophe/web-oidc-client/commit/442adedf6b4392d33b7f80f9e50af72305d96899))
- more explicit warn logs ([442aded](https://github.com/thechristophe/web-oidc-client/commit/442adedf6b4392d33b7f80f9e50af72305d96899))

## [0.0.12](https://github.com/thechristophe/web-oidc-client/compare/v0.0.11...v0.0.12) (2024-03-12)


### Bug Fixes

* **RenewLoginState:** return previous login status while refreshing ([634948a](https://github.com/thechristophe/web-oidc-client/commit/634948a9f17b7251176e58dd63275456a7cf7106))
- **RenewLoginState:** return previous login status while refreshing ([634948a](https://github.com/thechristophe/web-oidc-client/commit/634948a9f17b7251176e58dd63275456a7cf7106))

## [0.0.11](https://github.com/thechristophe/web-oidc-client/compare/v0.0.10...v0.0.11) (2024-03-10)


### Bug Fixes

* **IncomingRedirectState:** fix removing code from history ([381c227](https://github.com/thechristophe/web-oidc-client/commit/381c227422f8f670b2bc09db9d95a7bebebc7dbb))
- **IncomingRedirectState:** fix removing code from history ([381c227](https://github.com/thechristophe/web-oidc-client/commit/381c227422f8f670b2bc09db9d95a7bebebc7dbb))

## [0.0.10](https://github.com/thechristophe/web-oidc-client/compare/v0.0.9...v0.0.10) (2024-02-15)


### Bug Fixes

* add oauthority url to endpoints key ([cdfc441](https://github.com/thechristophe/web-oidc-client/commit/cdfc4417a61671424e019d9ccd6a874d9dfa4e76))
- add oauthority url to endpoints key ([cdfc441](https://github.com/thechristophe/web-oidc-client/commit/cdfc4417a61671424e019d9ccd6a874d9dfa4e76))

## [0.0.9](https://github.com/thechristophe/web-oidc-client/compare/v0.0.8...v0.0.9) (2024-01-27)


### Bug Fixes

* distinguish log messages ([91f1656](https://github.com/thechristophe/web-oidc-client/commit/91f1656a3d420ee2d8dfae4ea41ccd2093cbf764))
- distinguish log messages ([91f1656](https://github.com/thechristophe/web-oidc-client/commit/91f1656a3d420ee2d8dfae4ea41ccd2093cbf764))

## [0.0.8](https://github.com/thechristophe/web-oidc-client/compare/v0.0.7...v0.0.8) (2024-01-27)


### Bug Fixes

* correct state check, and simplify ([04b1ab3](https://github.com/thechristophe/web-oidc-client/commit/04b1ab36bcf417f524b18285eff42bbe6b033ba3))
- correct state check, and simplify ([04b1ab3](https://github.com/thechristophe/web-oidc-client/commit/04b1ab36bcf417f524b18285eff42bbe6b033ba3))

## [0.0.7](https://github.com/thechristophe/web-oidc-client/compare/v0.0.6...v0.0.7) (2024-01-27)


### Bug Fixes

* move state to sessionStorage ([1720edb](https://github.com/thechristophe/web-oidc-client/commit/1720edbfd92c6ce7c146d5c8db52ae4354a3db5f))
- move state to sessionStorage ([1720edb](https://github.com/thechristophe/web-oidc-client/commit/1720edbfd92c6ce7c146d5c8db52ae4354a3db5f))

## [0.0.6](https://github.com/thechristophe/web-oidc-client/compare/v0.0.5...v0.0.6) (2024-01-27)


### Bug Fixes

* more detailed error catching and logging ([d138c08](https://github.com/thechristophe/web-oidc-client/commit/d138c0833d09340b66db7cce96423e900e71c4c1))
- more detailed error catching and logging ([d138c08](https://github.com/thechristophe/web-oidc-client/commit/d138c0833d09340b66db7cce96423e900e71c4c1))

## [0.0.5](https://github.com/thechristophe/web-oidc-client/compare/v0.0.4...v0.0.5) (2024-01-26)

## [0.0.4](https://github.com/thechristophe/web-oidc-client/compare/v0.0.3...v0.0.4) (2024-01-25)


### Bug Fixes

* hide default debug messages, add debug flag ([d7f5051](https://github.com/thechristophe/web-oidc-client/commit/d7f5051a922458ea0806dbf75df5c5a86277d92b))
- hide default debug messages, add debug flag ([d7f5051](https://github.com/thechristophe/web-oidc-client/commit/d7f5051a922458ea0806dbf75df5c5a86277d92b))
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Web OIDC Client

## Introduction

This package provides a simple web browser client for OIDC authentication.

It is implemented as a state machine emitting state updates as events.
Expand All @@ -9,31 +10,32 @@ An example React/Next.js usage implementation can be found under examples/next.j
## Basic usage

```ts
const authClient = new AuthClient({
const authClient = new AuthClient(
{
clientId: 'fooBar',
//redirectUrl: `${window.location.origin}/oauth-redirect` // default
scopes: 'openid profile offline_access',

authority: 'https://boop.fynn.ai/oidc', // using .well-known/openid-configuration
// -- OR --
endpoints: {
authorization: "https://boop.fynn.ai/oidc/auth",
token: "https://boop.fynn.ai/oidc/token",
revocation: "https://boop.fynn.ai/oidc/token/revocation",
userinfo: "https://boop.fynn.ai/oidc/me"
}
authorization: 'https://boop.fynn.ai/oidc/auth',
token: 'https://boop.fynn.ai/oidc/token',
revocation: 'https://boop.fynn.ai/oidc/token/revocation',
userinfo: 'https://boop.fynn.ai/oidc/me',
},

// not functional at the moment
//autoLogin: true, // default
},
(newStatus: Status) => console.log(status)
(newStatus: Status) => console.log(status),
);
```

Once you are in the browser, call `authClient.browserInit()` for it to start its flow.
Once you are in the browser, call `authClient.browserInit()` for it to start its flow.
To log in, call `authClient.login()`, to logout, call `authClient.logout()`.
Changes in status will be communicated to the outside world through the event handler passed as second argument.

## States
![image](https://github.com/TheChristophe/web-oidc-client/assets/65168240/d09a1984-6f40-492a-b410-70ba4d7f1bd7)

![image](https://github.com/TheChristophe/web-oidc-client/assets/65168240/d09a1984-6f40-492a-b410-70ba4d7f1bd7)
2 changes: 1 addition & 1 deletion examples/next.js/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# React/Next.js example

AuthProvider contains an example of how to use the AuthClient in a next.js application. A similar implementation is
used at @furality.
used at @furality.
25 changes: 13 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.6",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/node": "^20.10.8",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"commit-and-tag-version": "^12.2.0",
"eslint": "^8.56.0",
"@types/node": "^20.14.14",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"commit-and-tag-version": "^12.4.1",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-github": "^4.10.1",
"eslint-plugin-github": "^4.10.2",
"eslint-plugin-import": "^2.29.1",
"prettier": "^3.1.1",
"rimraf": "^5.0.1",
"rollup": "^4.9.4",
"rollup-plugin-dts": "^6.1.0",
"prettier": "^3.3.3",
"rimraf": "^5.0.10",
"rollup": "^4.20.0",
"rollup-plugin-dts": "^6.1.1",
"rollup-plugin-peer-deps-external": "^2.2.4",
"typescript": "^5.3.3"
"typescript": "^5.5.4"
},
"files": [
"dist/",
Expand All @@ -57,5 +57,6 @@
}
},
"module": "./dist/index.js",
"typings": "./dist/index.d.ts"
"typings": "./dist/index.d.ts",
"packageManager": "[email protected]+sha512.38dc6fba8dba35b39340b9700112c2fe1e12f10b17134715a4aa98ccf7bb035e76fd981cf0bb384dfa98f8d6af5481c2bef2f4266a24bfa20c34eb7147ce0b5e"
}
Loading
Loading