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
commit 51ee63c124
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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);

@ -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);
}

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

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

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

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

@ -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