Skip to content

Commit

Permalink
Merge pull request #644 from immobiliare/next
Browse files Browse the repository at this point in the history
Next
  • Loading branch information
antoniomuso committed Mar 26, 2024
2 parents cf344a9 + 726f2d2 commit f825180
Show file tree
Hide file tree
Showing 9 changed files with 834 additions and 694 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [4.2.0-alpha.0](https://github.com/immobiliare/backstage-plugin-ldap-auth/compare/v4.1.0...v4.2.0-alpha.0) (2024-03-25)

### Features

- Support for Signin Error; Parameterizing Username label ([84941fa](https://github.com/immobiliare/backstage-plugin-ldap-auth/commit/84941fae0c1d42e82edda5872dfd37ca5970666e))
- upgrade auth backend ([e05c6b6](https://github.com/immobiliare/backstage-plugin-ldap-auth/commit/e05c6b605e060079dfb920289cc66ab4f55a3087))

# [4.1.0](https://github.com/immobiliare/backstage-plugin-ldap-auth/compare/v4.1.0-alpha.1...v4.1.0) (2024-03-11)

**Note:** Version bump only for package root
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"useNx": true,
"npmClient": "yarn",
"version": "4.1.0"
"version": "4.2.0-alpha.0"
}
6 changes: 6 additions & 0 deletions packages/ldap-auth-backend/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [4.2.0-alpha.0](https://github.com/immobiliare/backstage-plugin-ldap-auth/compare/v4.1.0...v4.2.0-alpha.0) (2024-03-25)

### Features

- upgrade auth backend ([e05c6b6](https://github.com/immobiliare/backstage-plugin-ldap-auth/commit/e05c6b605e060079dfb920289cc66ab4f55a3087))

# [4.1.0](https://github.com/immobiliare/backstage-plugin-ldap-auth/compare/v4.1.0-alpha.1...v4.1.0) (2024-03-11)

**Note:** Version bump only for package @immobiliarelabs/backstage-plugin-ldap-auth-backend
Expand Down
18 changes: 9 additions & 9 deletions packages/ldap-auth-backend/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@immobiliarelabs/backstage-plugin-ldap-auth-backend",
"description": "Backstage LDAP Authentication plugin, this packages adds backend authentication and token generation/validation/management; sibling of @immobiliarelabs/backstage-plugin-ldap-auth",
"version": "4.1.0",
"version": "4.2.0-alpha.0",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts",
"license": "MIT",
Expand All @@ -28,11 +28,11 @@
"postpack": "backstage-cli package postpack"
},
"dependencies": {
"@backstage/backend-plugin-api": "^0.6.13",
"@backstage/core-plugin-api": "^1.9.0",
"@backstage/errors": "^1.2.3",
"@backstage/plugin-auth-backend": "^0.21.3",
"@backstage/plugin-auth-node": "^0.4.8",
"@backstage/backend-plugin-api": "^0.6.15",
"@backstage/core-plugin-api": "^1.9.1",
"@backstage/errors": "^1.2.4",
"@backstage/plugin-auth-backend": "^0.22.2",
"@backstage/plugin-auth-node": "^0.4.10",
"keyv": "^4.3.3",
"ldap-authentication": "^3.0.3",
"ldap-escape": "^2.0.6",
Expand All @@ -42,9 +42,9 @@
"react": "^16.13.1 || ^17.0.0"
},
"devDependencies": {
"@backstage/backend-test-utils": "^0.3.3",
"@backstage/cli": "^0.25.2",
"@types/ldap-escape": "^2.0.0",
"@backstage/backend-test-utils": "^0.3.5",
"@backstage/cli": "^0.26.1",
"@types/ldap-escape": "^2.0.2",
"@types/ldapjs": "^2.2.4",
"@types/node": "^20.5.9",
"@types/supertest": "^6.0.2",
Expand Down
6 changes: 6 additions & 0 deletions packages/ldap-auth/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [4.2.0-alpha.0](https://github.com/immobiliare/backstage-plugin-ldap-auth/compare/v4.1.0...v4.2.0-alpha.0) (2024-03-25)

### Features

- Support for Signin Error; Parameterizing Username label ([84941fa](https://github.com/immobiliare/backstage-plugin-ldap-auth/commit/84941fae0c1d42e82edda5872dfd37ca5970666e))

# [4.1.0](https://github.com/immobiliare/backstage-plugin-ldap-auth/compare/v4.1.0-alpha.1...v4.1.0) (2024-03-11)

**Note:** Version bump only for package @immobiliarelabs/backstage-plugin-ldap-auth
Expand Down
2 changes: 1 addition & 1 deletion packages/ldap-auth/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@immobiliarelabs/backstage-plugin-ldap-auth",
"description": "Backstage LDAP Authentication plugin, this packages adds frontend login page and token management sibling of @immobiliarelabs/backstage-plugin-ldap-auth-backend",
"version": "4.1.0",
"version": "4.2.0-alpha.0",
"main": "dist/index.esm.js",
"types": "dist/index.d.ts",
"license": "MIT",
Expand Down
12 changes: 11 additions & 1 deletion packages/ldap-auth/src/components/LoginPage/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import PasswordValidator from 'password-validator';

export type LoginFormProps = {
onSubmit: (username: string, password: string) => void;
onSignInError?: (error: Error) => void;
error?: Error;
helperTextUsername?: string;
helperTextPassword?: string;
validateUsername?: (usr: string) => boolean;
validatePassword?: (pass: string) => boolean;
usernameLabel?: string;
};

const useStyles = makeStyles((theme) => ({
Expand All @@ -34,11 +36,13 @@ usernameSchema.is().min(4).is().max(40).not().spaces();

export const LoginForm = ({
onSubmit,
onSignInError,
error,
helperTextUsername,
helperTextPassword,
validatePassword,
validateUsername,
usernameLabel,
}: LoginFormProps) => {
const validatePasswd =
validatePassword || passwordSchema.validate.bind(passwordSchema);
Expand All @@ -60,6 +64,12 @@ export const LoginForm = ({
if (isUsernameValid && isPasswordValid) onSubmit(username, password);
}

useEffect(() => {
if (error && onSignInError) {
onSignInError(error);
}
}, [error, onSignInError]);

useEffect(() => {
const keyDownHandler = (event: {
key: string;
Expand All @@ -85,7 +95,7 @@ export const LoginForm = ({
<Paper elevation={4} className={classes.paper}>
<TextField
required
label="LDAP Name"
label={usernameLabel || 'LDAP Name'}
onChange={(e) => setUsername(e.target.value)}
value={username}
id="username"
Expand Down
13 changes: 12 additions & 1 deletion packages/ldap-auth/src/components/LoginPage/LoginPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ import { LoginForm } from './Form';
export type LdapSignInPageProps = SignInPageProps & {
provider: string;
children?: React.ReactNode | null;
onSignInError?: (error: Error) => void;
options?: {
helperTextPassword?: string;
helperTextUsername?: string;
validateUsername?: (usr: string) => boolean;
validatePassword?: (pass: string) => boolean;
usernameLabel?: string;
};
};

Expand Down Expand Up @@ -101,10 +103,19 @@ export const LdapSignInPage = (props: LdapSignInPageProps) => {
return null;
}

function onSignInError(error: Error) {
props?.onSignInError?.(error);
}

return (
<>
{props.children}
<LoginForm onSubmit={onSubmit} error={error} {...props.options} />
<LoginForm
onSubmit={onSubmit}
onSignInError={onSignInError}
error={error}
{...props.options}
/>
</>
);
};
Loading

0 comments on commit f825180

Please sign in to comment.