Skip to content

Cline generated code #7713

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

Closed
wants to merge 109 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
eeee622
Skeleton
Nov 8, 2024
897677b
Commit
Nov 10, 2024
8972d9e
Commit
Nov 11, 2024
bedfd47
Commit
Nov 11, 2024
55de7d9
Refactor 1
shenj Nov 19, 2024
b228f19
Update for design doc
shenj Nov 21, 2024
74b4431
Commit
shenj Nov 22, 2024
6c863f5
rename design doc
shenj Nov 22, 2024
cb321c9
Design update
shenj Nov 22, 2024
fc59df0
Commit
shenj Nov 22, 2024
09e1b25
Remove the design doc
shenj Nov 22, 2024
4ba880b
ignore build output
shenj Nov 27, 2024
35b4cee
Updates for feedbacks
shenj Nov 28, 2024
c589ec1
Commit
shenj Dec 9, 2024
c78a870
Commit
shenj Dec 9, 2024
284cee0
Restructure folders
shenj Dec 13, 2024
238a289
rename package
shenj Dec 13, 2024
fd0514e
Rename
shenj Dec 13, 2024
d80be99
feedbacks
shenj Dec 23, 2024
f259b87
- Setup msal-custom-auth sample for e2e
nguyencuong2596 Dec 24, 2024
e5d113b
Merge branch 'jiashen/sketeton' of https://github.com/AzureAD/microso…
nguyencuong2596 Dec 24, 2024
8821c6b
Commit
shenj Dec 24, 2024
0d7e08e
Merge branch 'dev' into jiashen/sketeton
nguyencuong2596 Dec 24, 2024
1546766
Change build command
nguyencuong2596 Dec 24, 2024
7bef47c
Update packages
nguyencuong2596 Dec 24, 2024
360914d
Alter build:all
nguyencuong2596 Dec 24, 2024
9c63cbf
Change files
nguyencuong2596 Dec 24, 2024
0f9a609
Fix lint and alter build:all
nguyencuong2596 Dec 24, 2024
a43a3e7
Change package
nguyencuong2596 Dec 24, 2024
a4456af
Modify build:all
nguyencuong2596 Dec 27, 2024
dd900f8
Update package lock
nguyencuong2596 Dec 27, 2024
dcdd889
Update package
nguyencuong2596 Dec 27, 2024
11a1501
Update package
nguyencuong2596 Dec 27, 2024
7e2a275
Update readme
nguyencuong2596 Dec 27, 2024
ebd1f05
Update package.json
nguyencuong2596 Dec 30, 2024
502f3b7
Change files
nguyencuong2596 Dec 30, 2024
c2693d4
Update sample-sample
nguyencuong2596 Dec 30, 2024
5ab330f
Add puppeteer and e2e-test-utils
nguyencuong2596 Dec 30, 2024
cef93eb
Format code
nguyencuong2596 Dec 30, 2024
bc4ddfb
Use shx rm instead of rimraf
nguyencuong2596 Dec 30, 2024
d810d5f
Update api document
nguyencuong2596 Dec 30, 2024
b611c3f
Common changes for signin
shenj Jan 8, 2025
8e9227d
Adding Sign up Api Client and Sign Up types
axhaferllari Jan 8, 2025
e06b701
Remove unused file
axhaferllari Jan 8, 2025
2a63c7d
Sign-in completed updated
shenj Jan 15, 2025
e745bac
Fix the style error
shenj Jan 16, 2025
ea58577
Merge pull request #7508 from AzureAD/custom-auth/jiashen/signin
shenj Jan 17, 2025
a65bf17
Create the interfaces for signup in network client (#7521)
shenj Jan 20, 2025
9974ee8
Custom auth/jiashen/sign up (#7542)
shenj Jan 30, 2025
12fec86
Add unit tests for sign-up
shenj Feb 1, 2025
7dc4f57
Add Api Clients for all endpoints (#7553)
albanx Feb 8, 2025
8a79e96
Fix the network client issue.
shenj Feb 9, 2025
c5d3c95
Fix the format issue
shenj Feb 9, 2025
acd5383
Reset password feature implementation
shenj Feb 11, 2025
4ac51c8
Add unit tests for password reset
shenj Feb 12, 2025
56cd81d
Add client_info property when calling signin token endpoint
shenj Feb 13, 2025
c756465
Support cache entities generation and caching
shenj Feb 17, 2025
3c0d349
[CustomAuth] Create React JS Sample skeleton
axhaferllari Feb 20, 2025
cf6aeb3
remove nextjs images
axhaferllari Feb 20, 2025
3b1927c
add npm install
axhaferllari Feb 21, 2025
a7cbbbb
Update instructions and docs
axhaferllari Feb 21, 2025
656223c
Fix override interfeer
axhaferllari Feb 21, 2025
8305029
GetCurrentAccount/SignOut implementation and a few improvements (#7586)
shenj Feb 25, 2025
aeeda3b
Support get access token
yongdiw Feb 25, 2025
81f2373
Remove msal-common references and create same function for generating…
yongdiw Feb 26, 2025
77c4209
Remove package.json changes
yongdiw Feb 26, 2025
79f4794
Fix comments
yongdiw Feb 26, 2025
f6bbdaa
Fix comments - moving functions, add default scopes, logs
yongdiw Feb 26, 2025
f564700
Fix comments - remove isRefreshTokenValid, remove un-needed error han…
yongdiw Feb 26, 2025
f18d393
Fix comments - move createCommonSilentFlowRequest, fix its unit tests
yongdiw Feb 26, 2025
06cec30
Merge branch 'dev' into custom-auth/main
shenj Feb 26, 2025
3a941b0
Fix the merge issue
shenj Feb 26, 2025
b74553b
Fix comments - remove unused idTokenHints constants and invalidScopes…
yongdiw Feb 27, 2025
104de21
Fix comments - update AuthorityMetadataEntity expireAt, update for ge…
yongdiw Feb 27, 2025
d0c60b9
Fix comments - give max safe integer
yongdiw Feb 27, 2025
1851cb1
Remove unused constants and references
yongdiw Feb 27, 2025
74f845f
Merge pull request #7595 from AzureAD/custom-auth/get-token
yongdiw Feb 27, 2025
e09aefb
Changing to yarn to avoid conflicts
axhaferllari Feb 28, 2025
da738a1
update readme
axhaferllari Feb 28, 2025
7c705fb
Merge branch 'custom-auth/main' into custom-auth/alban/react-nextjs-s…
axhaferllari Mar 2, 2025
ac6be7a
Fix: import Constant from msal-common and update version of msal-brow…
axhaferllari Mar 2, 2025
375b50a
Fix the errors introduced by msal-browser breaking changes (#7605)
shenj Mar 3, 2025
e63ae33
Update Error handling and log pii info
yongdiw Mar 3, 2025
53fa87a
comments - remove public key word
yongdiw Mar 4, 2025
3a3c4ad
Comments - add correlation id for all logs
yongdiw Mar 4, 2025
57bb20c
Comments - add subError property
yongdiw Mar 4, 2025
f140cec
Merge pull request #7608 from AzureAD/yongdi/error-handling-pii
yongdiw Mar 4, 2025
ab4ca74
Some improvements (#7607)
shenj Mar 5, 2025
e25a505
update pipeline config
axhaferllari Mar 5, 2025
5d0fb2c
add a sample test
axhaferllari Mar 5, 2025
f140870
Merge pull request #7583 from AzureAD/custom-auth/alban/react-nextjs-…
albanx Mar 5, 2025
69ae88b
Update logging level to use verbose and update index.ts (#7617)
yongdiw Mar 6, 2025
adbfc3c
Add Angular sample
axhaferllari Mar 8, 2025
159144b
Merge pull request #7625 from AzureAD/custom-auth/alban/angular-sample
albanx Mar 11, 2025
5a55c20
Merge remote-tracking branch 'origin/dev' into custom-auth/main
shenj Mar 12, 2025
d623c23
Rebuild
shenj Mar 12, 2025
cd2d065
Add doc for all public components and update index.ts (#7634)
yongdiw Mar 13, 2025
890f9e1
Fix the some unit tests which caused the open handles issue (#7619)
shenj Mar 13, 2025
7d7eba3
[Fix] Fix development on local and remove not needed checks, improved…
axhaferllari Mar 14, 2025
ca3df62
Fix extension module for discovery
axhaferllari Mar 14, 2025
4a63f57
fix linting issue
axhaferllari Mar 14, 2025
7d2a4e7
Merge pull request #7639 from AzureAD/custom-auth/alban/fix-for-dev
albanx Mar 14, 2025
398c424
Refactor the codes to remove the handler factory (#7665)
shenj Mar 31, 2025
7c49060
Merge dev branch changes and remove unused sample app (#7678)
shenj Apr 2, 2025
37b3172
package lock fix
shenj Apr 2, 2025
4f38594
Merge remote-tracking branch 'origin/dev' into custom-auth/main
shenj Apr 2, 2025
2314a2c
Change files
shenj Apr 7, 2025
72555ba
Support web fallback (#7698)
yongdiw Apr 17, 2025
fc770bb
Cline generated code
axhaferllari Apr 23, 2025
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
178 changes: 178 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
# AI Context File for MSAL Custom Authentication Project

## 📦 Description

MSAL Custom Authentication is a TypeScript-based library that extends Microsoft's Authentication Library (MSAL) to enable customized authentication experiences in modern web applications. Key features include:

- **Flexible Authentication Flows:**

- Sign-in with username/password or passwordless options
- Sign-up with customizable user attributes
- Password reset and account recovery
- Account management and token handling

- **UI Framework Agnostic:**

- Built as a headless authentication library
- Complete control over UI implementation
- Separation of authentication logic from presentation
- Seamless integration with any UI framework (React, Angular, Vue, vanilla JavaScript)

- **Developer-Friendly:**
- Strongly typed APIs for enhanced development experience
- Comprehensive error handling and logging
- Built-in state management for auth flows
- Clear separation of concerns for better maintainability

## 🧱 Technology Stack

- **Language & Runtime:**
- TypeScript 5.7+
- Node.js 10+
- **Core Dependencies:**
- @azure/msal-browser - Core MSAL browser library
- **Build System:**
- Rollup.js - Module bundling
- TypeScript compiler
- Babel - JavaScript compilation
- **Testing & Quality:**
- Jest - Testing framework with JSDOM environment
- ESLint - Code linting
- Prettier - Code formatting
- **Documentation:**
- TypeDoc - API documentation
- API Extractor - API report generation

## 🗂️ Structure

```
lib/msal-custom-auth/
├── src/ → Core library implementation
│ ├── configuration/ → Configuration related files
│ ├── controller/ → Controller implementation
│ ├── core/ → Core functionality and errors
│ │ ├── auth_flow/ → Base authentication flow classes
│ │ ├── error/ → Error type definitions
│ │ ├── interaction_client/ → Base interaction clients
│ │ ├── network_client/ → HTTP and API client implementations
│ │ │ ├── custom_auth_api/ → Custom auth API clients
│ │ │ └── http_client/ → HTTP client implementation
│ │ ├── telemetry/ → Telemetry implementations
│ │ └── utils/ → Utility functions
│ ├── get_account/ → Account retrieval functionality
│ ├── operating_context/ → Operating context implementation
│ ├── reset_password/ → Password reset flow
│ ├── sign_in/ → Sign-in flow implementation
│ │ ├── auth_flow/ → Sign-in authentication flow
│ │ │ ├── error_type/ → Sign-in specific errors
│ │ │ ├── result/ → Sign-in operation results
│ │ │ └── state/ → Sign-in flow states
│ │ └── interaction_client/ → Sign-in interaction handling
│ ├── sign_up/ → Sign-up flow implementation
│ │ ├── auth_flow/ → Sign-up authentication flow
│ │ │ ├── error_type/ → Sign-up specific errors
│ │ │ ├── result/ → Sign-up operation results
│ │ │ └── state/ → Sign-up flow states
│ │ └── interaction_client/ → Sign-up interaction handling
│ ├── index.ts → Library entry point
│ ├── CustomAuthPublicClientApplication.ts → Main application class
│ ├── CustomAuthActionInputs.ts → Action input type definitions
│ ├── CustomAuthConstants.ts → Constants definitions
│ ├── ICustomAuthPublicClientApplication.ts → Interface definitions
│ ├── packageMetadata.ts → Package version information
│ └── UserAccountAttributes.ts → User account attributes
├── test/ → Unit tests
├── package.json → Project dependencies and scripts
├── rollup.config.js → Build configuration
├── jest.config.cjs → Testing configuration
└── typedoc.json → Documentation generation config
```

## 🔁 Patterns & Conventions

### 📌 General

- Always define classes and significant logic in separate TypeScript files under `src/core/`.
- Public-facing APIs should be exposed through `src/index.ts`.
- Avoid embedding complex logic directly within entry points or utility scripts.

### 📌 Async Method Handling

- All methods interacting with network or authentication flows must be marked `async`.
- Properly await promises and handle exceptions internally using try-catch.

```typescript
async signInUser(credentials): Promise<AuthenticationResult> {
try {
const result = await this.performAuthentication(credentials);
return result;
} catch (error) {
logger.error("Sign-in error:", error);
throw error;
}
}
```

### 📌 Error Handling

- Use centralized logging for all caught exceptions (`logger.error()` for errors).
- Return standardized error objects to maintain consistency across API responses.

### 📌 Testing

- Unit tests must be located under `/test` directory, following `.spec.ts` naming convention.
- Maintain high test coverage, especially for core authentication flows.

## 🗝️ Key Files

- `src/index.ts`: Exports all public classes, interfaces, types, and constants.
- `src/CustomAuthPublicClientApplication.ts`: Main application class implementing custom authentication flows.
- `src/ICustomAuthPublicClientApplication.ts`: Interface definition for the main application.
- `src/CustomAuthActionInputs.ts`: Type definitions for authentication flow inputs.
- `src/CustomAuthConstants.ts`: Shared constants used throughout the library.
- `src/UserAccountAttributes.ts`: User account attribute management.
- `src/configuration/`: Configuration and initialization related files.
- `src/controller/`: Authentication flow controllers.
- `src/core/`: Core error handling and utilities.
- `src/get_account/`: Account retrieval and management.
- `src/sign_in/`, `src/sign_up/`, `src/reset_password/`: Authentication flow implementations.
- `package.json`: Manage dependencies and npm scripts.
- `rollup.config.js`: Defines build steps.
- `jest.config.cjs`: Testing framework setup.

## 🎯 Goals for Copilot / AI Tools

When modifying or extending authentication functionality:

- Keep main application logic in `CustomAuthPublicClientApplication.ts` focused on high-level flow coordination.
- Implement specific authentication flows in their dedicated directories (`sign_in/`, `sign_up/`, `reset_password/`).
- Place shared utilities and error handling in `src/core/`.
- Implement flow controllers in `src/controller/` to manage authentication state and operations.
- Define new action inputs in `CustomAuthActionInputs.ts`.
- Add any new constants to `CustomAuthConstants.ts`.
- Export all public APIs through `src/index.ts`.
- Write corresponding tests under `/test` folder immediately.
- Ensure proper error handling using the error types defined in `src/core/error/`.
- Follow established async patterns for all network and authentication operations.
- Use type-safe interfaces and maintain strict type checking throughout the codebase.

## 📚 Reference Files

- **Entry Point & Exports:** `src/index.ts`
- **Main Application:** `src/CustomAuthPublicClientApplication.ts`, `src/ICustomAuthPublicClientApplication.ts`
- **Authentication Flows:**
- `src/sign_in/`: Sign-in implementation
- `src/sign_up/`: Sign-up implementation
- `src/reset_password/`: Password reset implementation
- `src/get_account/`: Account management
- **Core Implementation:**
- `src/controller/`: Authentication flow controllers
- `src/core/`: Error handling and utilities
- `src/configuration/`: Configuration management
- `src/operating_context/`: Operating context implementation
- **Type Definitions & Constants:**
- `src/CustomAuthActionInputs.ts`: Action input types
- `src/UserAccountAttributes.ts`: User account attributes
- `src/CustomAuthConstants.ts`: Shared constants

> This context file is optimized for guidance of AI-driven coding tools like GitHub Copilot or ChatGPT, ensuring consistent implementation aligned with project standards.
7 changes: 6 additions & 1 deletion .github/issue_template_bot.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
"@azure/msal-node"
]
},
"msal-custom-auth": {
"searchStrings": [
"@azure/msal-custom-auth"
]
},
"adal-node": {
"searchStrings": [
"adal-node"
Expand Down Expand Up @@ -93,4 +98,4 @@
"incompleteTemplateMessage": "Please update the original issue and make sure to fill out the entire issue template so we can better assist you.",
"noTemplateMessage": "Please open a new issue and use one of the provided issue templates. Thanks!",
"noTemplateClose": true
}
}
2 changes: 2 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ msal-browser:
- lib/msal-browser/**/*
msal-react:
- lib/msal-react/**/*
msal-custom-auth:
- lib/msal-custom-auth/**/*
samples:
- samples/**/*
documentation:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -286,4 +286,5 @@ temp-cache.json
junit.xml

# ApiExtractor
temp/
temp/
samples/msal-custom-auth-samples/react-sample-nextjs/.next/
7 changes: 6 additions & 1 deletion .pipelines/1p-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ resources:
- repository: 1P
type: git
name: IDDP/msal-javascript-1p
ref: master
ref: custom-auth/pipeline # TODO: change back to master after pipeline is working

extends:
template: v2/OneBranch.NonOfficial.CrossPlat.yml@templates # https://aka.ms/obpipelines/templates
Expand Down Expand Up @@ -60,6 +60,11 @@ extends:
libName: msal-react
path: "lib/"
npmInstallTimeout: ${{ parameters.npmInstallTimeout }}
- template: .pipelines/templates/ci-template.yml@1P
parameters:
libName: msal-custom-auth
path: "lib/"
npmInstallTimeout: ${{ parameters.npmInstallTimeout }}
- template: .pipelines/templates/ci-template.yml@1P
parameters:
libName: msal-angular
Expand Down
Loading