Browse Source

Merge pull request #18049 from abpframework/auto-merge/rel-7-4/2260

Merge branch dev with rel-7.4
pull/18052/head
Enis Necipoglu 2 years ago
committed by GitHub
parent
commit
51ee63c124
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/AppUrlProvider.cs
  2. 2
      framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/IAppUrlProvider.cs
  3. 9
      modules/cms-kit/src/Volo.CmsKit.Public.Web/Security/Captcha/SimpleMathsCaptchaGenerator.cs
  4. 10
      npm/ng-packs/packages/core/src/lib/guards/permission.guard.ts
  5. 3
      npm/ng-packs/packages/oauth/src/lib/utils/auth-utils.ts
  6. 4
      templates/app-nolayers/angular/src/environments/environment.prod.ts
  7. 4
      templates/app-nolayers/angular/src/environments/environment.ts

10
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<string?> NormalizeUrlAsync(string? url)
{
if (string.IsNullOrWhiteSpace(url))
{
return url;
}
return await ReplacePlaceHoldersAsync(url!);
}
protected virtual async Task<string> GetConfiguredUrl(string appName, string? urlName)
{
var url = await GetUrlOrNullAsync(appName, urlName);

2
framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/IAppUrlProvider.cs

@ -10,4 +10,6 @@ public interface IAppUrlProvider
Task<string?> GetUrlOrNullAsync([NotNull] string appName, string? urlName = null);
bool IsRedirectAllowedUrl(string url);
Task<string?> NormalizeUrlAsync(string? url);
}

9
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 =>

10
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);
}
}),

3
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 {

4
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',
},
},

4
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',
},
},

Loading…
Cancel
Save