Skip to content

Commit

Permalink
fix(oidc): lint (alpha)
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume-chervet committed Jul 19, 2024
1 parent e4f4d97 commit f1d9da4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
6 changes: 3 additions & 3 deletions packages/oidc-client-service-worker/src/jwt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ export const defaultDemonstratingProofOfPossessionConfiguration: DemonstratingPr
const sign =
(w: any) =>
async (
jwk,
headers,
claims,
jwk: any,
headers: any,
claims: any,
demonstratingProofOfPossessionConfiguration: DemonstratingProofOfPossessionConfiguration,
jwtHeaderType = 'dpop+jwt',
) => {
Expand Down
16 changes: 11 additions & 5 deletions packages/oidc-client/src/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { getValidTokenAsync } from './parseTokens';
import { Fetch } from './types';
import Oidc from './oidc';
import {getValidTokenAsync, OidcToken, Tokens} from './parseTokens';

Check failure on line 2 in packages/oidc-client/src/fetch.ts

View workflow job for this annotation

GitHub Actions / Run linters

Replace `getValidTokenAsync,·OidcToken,·Tokens` with `·getValidTokenAsync,·OidcToken,·Tokens·`

Check failure on line 2 in packages/oidc-client/src/fetch.ts

View workflow job for this annotation

GitHub Actions / Run linters

'Tokens' is defined but never used
import {Fetch, StringMap, TokenAutomaticRenewMode} from './types';

Check failure on line 3 in packages/oidc-client/src/fetch.ts

View workflow job for this annotation

GitHub Actions / Run linters

Replace `Fetch,·StringMap,·TokenAutomaticRenewMode` with `·Fetch,·StringMap,·TokenAutomaticRenewMode·`

Check failure on line 3 in packages/oidc-client/src/fetch.ts

View workflow job for this annotation

GitHub Actions / Run linters

'StringMap' is defined but never used

Check failure on line 3 in packages/oidc-client/src/fetch.ts

View workflow job for this annotation

GitHub Actions / Run linters

'TokenAutomaticRenewMode' is defined but never used

// @ts-ignore
export const fetchWithTokens =
(

Check failure on line 7 in packages/oidc-client/src/fetch.ts

View workflow job for this annotation

GitHub Actions / Run linters

Replace `⏎····fetch:·Fetch,⏎····oidc:·Oidc·|·null,⏎····demonstrating_proof_of_possession:·boolean·=·false,⏎··` with `fetch:·Fetch,·oidc:·Oidc·|·null,·demonstrating_proof_of_possession:·boolean·=·false`
fetch: Fetch,
oidcClient: Oidc | null,
oidc: Oidc | null,
demonstrating_proof_of_possession: boolean = false,
): Fetch =>
async (...params: Parameters<Fetch>): Promise<Response> => {
Expand All @@ -17,10 +18,15 @@ export const fetchWithTokens =
? new Headers(optionTmp.headers)
: optionTmp.headers;
}
const oidc = oidcClient;

Check failure on line 21 in packages/oidc-client/src/fetch.ts

View workflow job for this annotation

GitHub Actions / Run linters

Delete `····`
const oidcToken : OidcToken = {

Check failure on line 22 in packages/oidc-client/src/fetch.ts

View workflow job for this annotation

GitHub Actions / Run linters

Delete `·`
tokens: oidc.tokens,
configuration: { token_automatic_renew_mode: oidc.configuration.token_automatic_renew_mode },
renewTokensAsync: oidc.renewTokensAsync,
}

Check failure on line 26 in packages/oidc-client/src/fetch.ts

View workflow job for this annotation

GitHub Actions / Run linters

Insert `;`

// @ts-ignore
const getValidToken = await getValidTokenAsync(oidc);
const getValidToken = await getValidTokenAsync(oidcToken);
const accessToken = getValidToken?.tokens?.accessToken;
if (!headers.has('Accept')) {
headers.set('Accept', 'application/json');
Expand Down
2 changes: 1 addition & 1 deletion packages/oidc-client/src/oidcClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class OidcClient {
}

fetchWithTokens(fetch: Fetch, demonstrating_proof_of_possession: boolean = false): Fetch {
return fetchWithTokens(fetch, this, demonstrating_proof_of_possession);
return fetchWithTokens(fetch, this._oidc, demonstrating_proof_of_possession);
}

async userInfoAsync<T extends OidcUserInfo = OidcUserInfo>(
Expand Down

0 comments on commit f1d9da4

Please sign in to comment.