feat: rewrite AuthService to use ROLAC auth API with in-memory token storage
- Replace GET /api/Token/Create (Basic Auth) with POST /api/Auth/login - Add refresh() method using HttpOnly cookie (POST /api/Auth/refresh) - Add initializeFromRefreshToken() for APP_INITIALIZER support - logout() now fires POST /api/Auth/logout (fire-and-forget) - Rename User interface to UserInfo (matches C# DTO: id, email, roles, languagePreference) - All auth state is in-memory only (no localStorage) - Fix downstream consumers: app.ts, header components, mfa-dialog, token-verification - Fix tsconfig.spec.json: exclude legacy src/components and src/directives - Add stub enums.model.ts and fix models/index.ts for pre-existing build errors Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,6 @@ import { FormsModule } from '@angular/forms';
|
||||
import { ButtonsModule } from '@progress/kendo-angular-buttons';
|
||||
import { IndicatorsModule } from '@progress/kendo-angular-indicators';
|
||||
import { AuthService, LoginCredentials, LoginResultType } from '../services/auth.service';
|
||||
import { take } from 'rxjs/operators';
|
||||
|
||||
const CODE_LENGTH = 6;
|
||||
|
||||
@@ -173,28 +172,8 @@ export class MfaDialogComponent {
|
||||
this.processing = true;
|
||||
this.loginData.mfaCode = this.token;
|
||||
|
||||
// Check if this is token-based authentication
|
||||
if ((this.loginData as any).tokenUser) {
|
||||
// Handle token-based MFA verification
|
||||
this.authService.verifyMfaForToken(this.token, (this.loginData as any).tokenUser).subscribe({
|
||||
next: (result) => {
|
||||
this.processing = false;
|
||||
|
||||
if (result.result === LoginResultType.Success) {
|
||||
this.mfaSuccess.emit(result.responseData);
|
||||
this.visible = false;
|
||||
} else {
|
||||
this.isInvalidCode = true;
|
||||
}
|
||||
},
|
||||
error: (error) => {
|
||||
this.processing = false;
|
||||
this.isInvalidCode = true;
|
||||
console.error('MFA verification error:', error);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Handle regular login MFA verification
|
||||
// Handle login MFA verification
|
||||
{
|
||||
this.authService.login(this.loginData).subscribe({
|
||||
next: (result) => {
|
||||
this.processing = false;
|
||||
@@ -230,17 +209,7 @@ export class MfaDialogComponent {
|
||||
|
||||
// Simulate resend MFA code - replace with actual service call
|
||||
console.log('Resending MFA code to:', this.loginData.email);
|
||||
// Check if this is token-based authentication
|
||||
if ((this.loginData as any).tokenUser) {
|
||||
// Handle token-based MFA verification
|
||||
this.authService.verifyMfaForToken(this.token, (this.loginData as any).tokenUser).pipe(
|
||||
take(1)
|
||||
).subscribe(result => {
|
||||
this.setReSendCountDown();
|
||||
});
|
||||
} else {
|
||||
//TODO: Implement resend MFA code for regular login
|
||||
}
|
||||
//TODO: Implement resend MFA code for regular login
|
||||
this.setReSendCountDown();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user