auth-node: move identity related modules to identity dir

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-07-26 16:42:40 +02:00
parent 52af2a8472
commit 1e5baf0c6e
10 changed files with 23 additions and 26 deletions
@@ -26,7 +26,7 @@ import { setupServer } from 'msw/node';
import { v4 as uuid } from 'uuid';
import { DefaultIdentityClient } from './DefaultIdentityClient';
import { IdentityApiGetIdentityRequest } from './types';
import { IdentityApiGetIdentityRequest } from './IdentityApi';
interface AnyJWK extends Record<string, string> {
use: 'sig';
@@ -25,12 +25,9 @@ import {
jwtVerify,
} from 'jose';
import { GetKeyFunction } from 'jose/dist/types/types';
import {
BackstageIdentityResponse,
IdentityApiGetIdentityRequest,
} from './types';
import { getBearerTokenFromAuthorizationHeader } from './getBearerTokenFromAuthorizationHeader';
import { IdentityApi } from './IdentityApi';
import { IdentityApi, IdentityApiGetIdentityRequest } from './IdentityApi';
import { BackstageIdentityResponse } from '../types';
const CLOCK_MARGIN_S = 10;
@@ -13,10 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
BackstageIdentityResponse,
IdentityApiGetIdentityRequest,
} from './types';
import { Request } from 'express';
import { BackstageIdentityResponse } from '../types';
/**
* Options to request the identity from a Backstage backend request
*
* @public
*/
export type IdentityApiGetIdentityRequest = {
request: Request<unknown>;
};
/**
* An identity client api to authenticate Backstage
@@ -18,7 +18,7 @@ import {
DefaultIdentityClient,
IdentityClientOptions,
} from './DefaultIdentityClient';
import { BackstageIdentityResponse } from './types';
import { BackstageIdentityResponse } from '../types';
/**
* An identity client to interact with auth-backend and authenticate Backstage
+7
View File
@@ -15,3 +15,10 @@
*/
export { prepareBackstageIdentityResponse } from './prepareBackstageIdentityResponse';
export { getBearerTokenFromAuthorizationHeader } from './getBearerTokenFromAuthorizationHeader';
export {
DefaultIdentityClient,
type IdentityClientOptions,
} from './DefaultIdentityClient';
export { IdentityClient } from './IdentityClient';
export type { IdentityApi } from './IdentityApi';
-6
View File
@@ -23,11 +23,6 @@
export * from './flow';
export * from './identity';
export * from './passport';
export { getBearerTokenFromAuthorizationHeader } from './getBearerTokenFromAuthorizationHeader';
export { DefaultIdentityClient } from './DefaultIdentityClient';
export { IdentityClient } from './IdentityClient';
export type { IdentityApi } from './IdentityApi';
export type { IdentityClientOptions } from './DefaultIdentityClient';
export type {
AuthProviderConfig,
AuthProviderRouteHandlers,
@@ -39,7 +34,6 @@ export type {
BackstageUserIdentity,
ClientAuthResponse,
CookieConfigurer,
IdentityApiGetIdentityRequest,
ProfileInfo,
SignInInfo,
SignInResolver,
-9
View File
@@ -36,15 +36,6 @@ export interface BackstageSignInResult {
token: string;
}
/**
* Options to request the identity from a Backstage backend request
*
* @public
*/
export type IdentityApiGetIdentityRequest = {
request: Request<unknown>;
};
/**
* Response object containing the {@link BackstageUserIdentity} and the token
* from the authentication provider.