diff --git a/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/AppUrlProvider.cs b/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/AppUrlProvider.cs index a258d3f8ab..b8bebd95a5 100644 --- a/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/AppUrlProvider.cs +++ b/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/AppUrlProvider.cs @@ -53,6 +53,16 @@ public class AppUrlProvider : IAppUrlProvider, ITransientDependency return allow; } + public virtual async Task NormalizeUrlAsync(string? url) + { + if (string.IsNullOrWhiteSpace(url)) + { + return url; + } + + return await ReplacePlaceHoldersAsync(url!); + } + protected virtual async Task GetConfiguredUrl(string appName, string? urlName) { var url = await GetUrlOrNullAsync(appName, urlName); diff --git a/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/IAppUrlProvider.cs b/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/IAppUrlProvider.cs index 9241c5f428..4e800a524e 100644 --- a/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/IAppUrlProvider.cs +++ b/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/IAppUrlProvider.cs @@ -10,4 +10,6 @@ public interface IAppUrlProvider Task GetUrlOrNullAsync([NotNull] string appName, string? urlName = null); bool IsRedirectAllowedUrl(string url); + + Task NormalizeUrlAsync(string? url); } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Security/Captcha/SimpleMathsCaptchaGenerator.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Security/Captcha/SimpleMathsCaptchaGenerator.cs index f4f8ee85ed..f8f1c3d071 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Security/Captcha/SimpleMathsCaptchaGenerator.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Security/Captcha/SimpleMathsCaptchaGenerator.cs @@ -166,10 +166,11 @@ public class SimpleMathsCaptchaGenerator : ITransientDependency var x0 = random.Next(0, img.Width - 1); var y0 = random.Next(0, img.Height - 1); img.Mutate( - ctx => ctx - .DrawLine(options.NoiseRateColor[random.Next(0, options.NoiseRateColor.Length)], - RandomTextGenerator.GenerateNextFloat(0.5, 1.5), new PointF[] { new Vector2(x0, y0), new Vector2(x0, y0) }) - ); + ctx => ctx + .DrawLine(options.NoiseRateColor[random.Next(0, options.NoiseRateColor.Length)], + RandomTextGenerator.GenerateNextFloat(0.5, 1.5), + new PointF[] { new Vector2(x0, y0), new Vector2(x0 + 0.005f, y0 + 0.005f) }) + ); }); img.Mutate(x => diff --git a/npm/ng-packs/packages/core/src/lib/guards/permission.guard.ts b/npm/ng-packs/packages/core/src/lib/guards/permission.guard.ts index ae3fdb6e37..a4576d41bf 100644 --- a/npm/ng-packs/packages/core/src/lib/guards/permission.guard.ts +++ b/npm/ng-packs/packages/core/src/lib/guards/permission.guard.ts @@ -1,13 +1,9 @@ import { Injectable, inject } from '@angular/core'; import { ActivatedRouteSnapshot, Router, RouterStateSnapshot } from '@angular/router'; import { HttpErrorResponse } from '@angular/common/http'; - import { Observable, of } from 'rxjs'; import { tap } from 'rxjs/operators'; - -import { OAuthService } from 'angular-oauth2-oidc'; - -import { IAbpGuard } from '../abstracts'; +import { AuthService, IAbpGuard } from '../abstracts'; import { findRoute, getRoutePath } from '../utils/route-utils'; import { RoutesService, PermissionService, HttpErrorReporterService } from '../services'; @@ -17,7 +13,7 @@ import { RoutesService, PermissionService, HttpErrorReporterService } from '../s export class PermissionGuard implements IAbpGuard { protected readonly router = inject(Router); protected readonly routesService = inject(RoutesService); - protected readonly oAuthService = inject(OAuthService); + protected readonly oAuthService = inject(AuthService); protected readonly permissionService = inject(PermissionService); protected readonly httpErrorReporter = inject(HttpErrorReporterService); @@ -33,7 +29,7 @@ export class PermissionGuard implements IAbpGuard { return this.permissionService.getGrantedPolicy$(requiredPolicy).pipe( tap(access => { - if (!access && this.oAuthService.hasValidAccessToken()) { + if (!access && this.oAuthService.isAuthenticated) { this.httpErrorReporter.reportError({ status: 403 } as HttpErrorResponse); } }), diff --git a/npm/ng-packs/packages/oauth/src/lib/utils/auth-utils.ts b/npm/ng-packs/packages/oauth/src/lib/utils/auth-utils.ts index f1dc5b6106..bd50e97ee7 100644 --- a/npm/ng-packs/packages/oauth/src/lib/utils/auth-utils.ts +++ b/npm/ng-packs/packages/oauth/src/lib/utils/auth-utils.ts @@ -1,6 +1,5 @@ -import { inject, Injector } from '@angular/core'; +import { Injector } from '@angular/core'; import { Router } from '@angular/router'; -import { OAuthStorage, TokenResponse } from 'angular-oauth2-oidc'; import { pipe } from 'rxjs'; import { switchMap, tap } from 'rxjs/operators'; import { diff --git a/templates/app-nolayers/angular/src/environments/environment.prod.ts b/templates/app-nolayers/angular/src/environments/environment.prod.ts index e6cc007d52..7702e6fc43 100644 --- a/templates/app-nolayers/angular/src/environments/environment.prod.ts +++ b/templates/app-nolayers/angular/src/environments/environment.prod.ts @@ -10,7 +10,7 @@ export const environment = { logoUrl: '', }, oAuthConfig: { - issuer: 'https://localhost:44305/', + issuer: 'https://localhost:44300/', redirectUri: baseUrl, clientId: 'MyProjectName_App', responseType: 'code', @@ -19,7 +19,7 @@ export const environment = { }, apis: { default: { - url: 'https://localhost:44305', + url: 'https://localhost:44300', rootNamespace: 'MyCompanyName.MyProjectName', }, }, diff --git a/templates/app-nolayers/angular/src/environments/environment.ts b/templates/app-nolayers/angular/src/environments/environment.ts index 04dc6e89f3..f12e925ee9 100644 --- a/templates/app-nolayers/angular/src/environments/environment.ts +++ b/templates/app-nolayers/angular/src/environments/environment.ts @@ -10,7 +10,7 @@ export const environment = { logoUrl: '', }, oAuthConfig: { - issuer: 'https://localhost:44305/', + issuer: 'https://localhost:44300/', redirectUri: baseUrl, clientId: 'MyProjectName_App', responseType: 'code', @@ -19,7 +19,7 @@ export const environment = { }, apis: { default: { - url: 'https://localhost:44305', + url: 'https://localhost:44300', rootNamespace: 'MyCompanyName.MyProjectName', }, },