authmosphere
Advanced tools
Comparing version 4.0.5 to 4.0.6
@@ -67,3 +67,3 @@ import { RequestHandler } from 'express'; | ||
*/ | ||
declare type requireScopesMiddleware = (scopes: string[], options?: ScopeMiddlewareOptions) => RequestHandler; | ||
type requireScopesMiddleware = (scopes: string[], options?: ScopeMiddlewareOptions) => RequestHandler; | ||
declare const requireScopesMiddleware: requireScopesMiddleware; | ||
@@ -91,4 +91,4 @@ /** | ||
*/ | ||
declare type authenticationMiddleware = (options: AuthenticationMiddlewareOptions) => RequestHandler; | ||
type authenticationMiddleware = (options: AuthenticationMiddlewareOptions) => RequestHandler; | ||
declare const authenticationMiddleware: authenticationMiddleware; | ||
export { PrecedenceFunction, PrecedenceOptions, requireScopesMiddleware, authenticationMiddleware }; |
import { TokenCacheOAuthConfig, Token, TokenCacheOptions, CacheConfig } from './types'; | ||
declare const defaultCacheConfig: CacheConfig; | ||
declare type TokenMap = { | ||
type TokenMap = { | ||
[key: string]: Token | undefined; | ||
@@ -5,0 +5,0 @@ }; |
import { NextFunction, Request, Response } from 'express'; | ||
import { Logger, GetTokenInfo } from '.'; | ||
declare type onNotAuthenticatedHandler = (request: Request, resonse: Response, next: NextFunction, logger: Logger) => void; | ||
declare type AuthenticationMiddlewareOptions = { | ||
type onNotAuthenticatedHandler = (request: Request, resonse: Response, next: NextFunction, logger: Logger) => void; | ||
type AuthenticationMiddlewareOptions = { | ||
tokenInfoEndpoint: string; | ||
@@ -6,0 +6,0 @@ logger?: Logger; |
/// <reference types="node" /> | ||
declare type BodyParameters = NodeJS.Dict<string | number | boolean | string[] | number[] | boolean[] | null> & { | ||
type BodyParameters = NodeJS.Dict<string | number | boolean | string[] | number[] | boolean[] | null> & { | ||
grant_type: string; | ||
@@ -4,0 +4,0 @@ username?: string; |
import { Logger, Token } from '.'; | ||
declare type GetTokenInfo<T = Record<string | number | symbol, unknown>> = (tokenInfoUrl: string, accessToken: string, logger?: Logger) => Promise<Token<T>>; | ||
type GetTokenInfo<T = Record<string | number | symbol, unknown>> = (tokenInfoUrl: string, accessToken: string, logger?: Logger) => Promise<Token<T>>; | ||
export { GetTokenInfo }; |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
declare type LogFunction = (message: string, ...args: any[]) => void; | ||
type LogFunction = (message: string, ...args: any[]) => void; | ||
interface Logger { | ||
@@ -8,0 +8,0 @@ info: LogFunction; |
@@ -1,16 +0,16 @@ | ||
declare type CredentialsDirConfig = { | ||
type CredentialsDirConfig = { | ||
credentialsDir: string; | ||
}; | ||
declare type CredentialsClientConfig = { | ||
type CredentialsClientConfig = { | ||
clientId: string; | ||
clientSecret: string; | ||
}; | ||
declare type CredentialsUserConfig = { | ||
type CredentialsUserConfig = { | ||
applicationUsername: string; | ||
applicationPassword: string; | ||
}; | ||
declare type CredentialsUserClientConfig = CredentialsClientConfig & CredentialsUserConfig; | ||
declare type CredentialsConfig = CredentialsDirConfig | CredentialsClientConfig; | ||
declare type CredentialsPasswordConfig = CredentialsDirConfig | CredentialsUserClientConfig; | ||
declare type GrantConfigBase = { | ||
type CredentialsUserClientConfig = CredentialsClientConfig & CredentialsUserConfig; | ||
type CredentialsConfig = CredentialsDirConfig | CredentialsClientConfig; | ||
type CredentialsPasswordConfig = CredentialsDirConfig | CredentialsUserClientConfig; | ||
type GrantConfigBase = { | ||
grantType: string; | ||
@@ -26,15 +26,15 @@ accessTokenEndpoint: string; | ||
}; | ||
declare type ClientCredentialsGrantConfig = CredentialsConfig & GrantConfigBase; | ||
declare type AuthorizationCodeGrantConfig = CredentialsConfig & GrantConfigBase & { | ||
type ClientCredentialsGrantConfig = CredentialsConfig & GrantConfigBase; | ||
type AuthorizationCodeGrantConfig = CredentialsConfig & GrantConfigBase & { | ||
code: string; | ||
redirectUri: string; | ||
}; | ||
declare type PasswordCredentialsGrantConfig = CredentialsPasswordConfig & GrantConfigBase; | ||
declare type RefreshGrantConfig = CredentialsConfig & GrantConfigBase & { | ||
type PasswordCredentialsGrantConfig = CredentialsPasswordConfig & GrantConfigBase; | ||
type RefreshGrantConfig = CredentialsConfig & GrantConfigBase & { | ||
refreshToken: string; | ||
}; | ||
declare type OAuthConfig = ClientCredentialsGrantConfig | AuthorizationCodeGrantConfig | PasswordCredentialsGrantConfig | RefreshGrantConfig; | ||
declare type TokenCacheOAuthConfig = (ClientCredentialsGrantConfig | PasswordCredentialsGrantConfig) & { | ||
type OAuthConfig = ClientCredentialsGrantConfig | AuthorizationCodeGrantConfig | PasswordCredentialsGrantConfig | RefreshGrantConfig; | ||
type TokenCacheOAuthConfig = (ClientCredentialsGrantConfig | PasswordCredentialsGrantConfig) & { | ||
tokenInfoEndpoint: string; | ||
}; | ||
export { CredentialsDirConfig, CredentialsUserConfig, CredentialsClientConfig, CredentialsUserClientConfig, CredentialsPasswordConfig, CredentialsConfig, GrantConfigBase, ClientCredentialsGrantConfig, AuthorizationCodeGrantConfig, PasswordCredentialsGrantConfig, RefreshGrantConfig, OAuthConfig, TokenCacheOAuthConfig }; |
import { Request, Response, NextFunction } from 'express'; | ||
import { PrecedenceOptions, Logger } from '.'; | ||
declare type onAuthorizationFailedHandler = (request: Request, resonse: Response, next: NextFunction, scopes: string[], logger: Logger) => void; | ||
type onAuthorizationFailedHandler = (request: Request, resonse: Response, next: NextFunction, scopes: string[], logger: Logger) => void; | ||
interface ScopeMiddlewareOptions { | ||
@@ -5,0 +5,0 @@ logger?: Logger; |
@@ -1,2 +0,2 @@ | ||
declare type Token<CustomTokenPart = Record<string | number | symbol, unknown>> = CustomTokenPart & { | ||
type Token<CustomTokenPart = Record<string | number | symbol, unknown>> = CustomTokenPart & { | ||
access_token: string; | ||
@@ -3,0 +3,0 @@ expires_in?: number; |
import { Logger } from './'; | ||
declare type CacheConfig = { | ||
type CacheConfig = { | ||
percentageLeft: number; | ||
}; | ||
declare type TokenCacheOptions = { | ||
type TokenCacheOptions = { | ||
cacheConfig?: CacheConfig; | ||
@@ -7,0 +7,0 @@ logger?: Logger; |
@@ -50,3 +50,3 @@ import { Request, Response } from 'express'; | ||
*/ | ||
declare type rejectRequest = (res: Response, logger: Logger, status: number) => void; | ||
type rejectRequest = (res: Response, logger: Logger, status: number) => void; | ||
declare const rejectRequest: rejectRequest; | ||
@@ -53,0 +53,0 @@ declare const isCredentialsDirConfig: (options: Record<string | number | symbol, unknown>) => options is CredentialsDirConfig; |
{ | ||
"name": "authmosphere", | ||
"version": "4.0.5", | ||
"version": "4.0.6", | ||
"description": "authmosphere is a library to support OAuth2 workflows in JavaScript projects.", | ||
@@ -37,15 +37,15 @@ "main": "./lib/src/index.js", | ||
"@types/chai-as-promised": "7.1.5", | ||
"@types/mocha": "10.0.0", | ||
"@types/node": "18.11.9", | ||
"@types/mocha": "10.0.1", | ||
"@types/node": "18.11.14", | ||
"@types/node-fetch": "2.6.2", | ||
"@types/sinon-chai": "3.2.9", | ||
"@types/sinonjs__fake-timers": "8.1.2", | ||
"@types/uuid": "8.3.4", | ||
"@typescript-eslint/eslint-plugin": "5.42.1", | ||
"@typescript-eslint/eslint-plugin-tslint": "5.42.1", | ||
"@typescript-eslint/parser": "5.42.1", | ||
"@types/uuid": "9.0.0", | ||
"@typescript-eslint/eslint-plugin": "5.46.1", | ||
"@typescript-eslint/eslint-plugin-tslint": "5.46.1", | ||
"@typescript-eslint/parser": "5.46.1", | ||
"chai": "4.3.7", | ||
"chai-as-promised": "7.1.1", | ||
"coveralls": "3.1.1", | ||
"eslint": "8.27.0", | ||
"eslint": "8.29.0", | ||
"eslint-plugin-chai-friendly": "0.7.2", | ||
@@ -55,7 +55,7 @@ "eslint-plugin-mocha": "10.1.0", | ||
"express": "4.18.2", | ||
"mocha": "10.1.0", | ||
"mocha": "10.2.0", | ||
"nyc": "15.1.0", | ||
"sinon": "14.0.2", | ||
"sinon": "15.0.0", | ||
"sinon-chai": "3.7.0", | ||
"typescript": "4.8.4" | ||
"typescript": "4.9.4" | ||
}, | ||
@@ -62,0 +62,0 @@ "scripts": { |
229588