Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.subscribe(result => {
// set abp login info
const tokenExpireDate = remember
? new Date(new Date().getTime() + 1000 * result.expireInSeconds)
: undefined;
this._abpTokenService.setToken(result.accessToken, tokenExpireDate);
this._utilsService.setCookieValue(
AppConsts.authorization.encrptedAuthTokenName,
result.encryptedAccessToken,
tokenExpireDate,
abp.appPath,
);
// 设置用户Token信息
let jwt = new JWTTokenModel();
jwt.token = result.accessToken;
this._tokenService.set(jwt);
if (callback) {
callback();
}
}, (err: any) => finalize(err));
}
export function fnDelonAuthConfig(): DelonAuthConfig {
return {
...new DelonAuthConfig(),
...{ login_url: '/passport/login', ignores: [/\/login/, /assets\//, /api\/(?!admin)[\w_-]+\/\S*/] } as DelonAuthConfig
};
}
export function fnDelonAuthConfig(): DelonAuthConfig {
return {
...new DelonAuthConfig(),
login_url: '/passport/login',
ignores: [
/assets\//,
/passport\//,
/api\/(?!admin)[\w_-]+\/\S*/
]
};
}
intercept(req: HttpRequest, next: HttpHandler): Observable> {
const options = { ...new DelonAuthConfig(), ...this.injector.get(DelonAuthConfig, undefined) };
req = this.addToken(req, options, null);
return next.handle(req).pipe(
mergeMap((event: any) => {
if (event instanceof HttpResponseBase) {
if (event.status === 200 && (event instanceof HttpResponse)) {
const result: AjaxResult = event.body as AjaxResult;
if (result && result.Type === AjaxResultType.UnAuth) {
return this.handle401Error(req, next, options, event);
}
}
}
return of(event);
}),
catchError((error: HttpErrorResponse) => {
if (error instanceof HttpErrorResponse && error.status === 401) {
export function fnDelonAuthConfig(): DelonAuthConfig {
return {
...new DelonAuthConfig(),
...{
login_url: '/passport/login',
executeOtherInterceptors: false
} as DelonAuthConfig
};
}
export function fnDelonAuthConfig(): DelonAuthConfig {
return {
...new DelonAuthConfig(),
login_url: '/passport/login',
ignores: [
/assets\//,
/passport\//,
/api\/(?!admin)[\w_-]+\/\S*/
]
};
}
intercept(req: HttpRequest, next: HttpHandler): Observable> {
const options = { ...new DelonAuthConfig(), ...this.injector.get(DelonAuthConfig, undefined) };
req = this.addToken(req, options, null);
return next.handle(req).pipe(
mergeMap((event: any) => {
if (event instanceof HttpResponseBase) {
if (event.status === 200 && (event instanceof HttpResponse)) {
const result: AjaxResult = event.body as AjaxResult;
if (result && result.Type === AjaxResultType.UnAuth) {
return this.handle401Error(req, next, options, event);
}
}
}
return of(event);
}),
catchError((error: HttpErrorResponse) => {
if (error instanceof HttpErrorResponse && error.status === 401) {
export function fnDelonAuthConfig(): DelonAuthConfig {
return {
...new DelonAuthConfig(),
...{ login_url: '/passport/login' } as DelonAuthConfig
};
}
import { DelonAuthModule, SimpleInterceptor } from '@delon/auth';
import { DelonACLModule } from '@delon/acl';
registerLocaleData(zh);
@NgModule({
declarations: [
AppComponent,
],
imports: [
BrowserModule,
CoreModule,
LayoutModule,
RoutesModule,
SharedModule,
HttpClientModule,
DelonAuthModule.forRoot(),
DelonACLModule.forRoot(),
BrowserAnimationsModule,
],
providers: [
{ provide: HTTP_INTERCEPTORS, useClass: SimpleInterceptor, multi: true },
{ provide: NZ_NOTIFICATION_CONFIG, useValue: { nzMaxStack: 1 } },
{ provide: NZ_I18N, useValue: zh_CN },
ApiService,
{
provide: API_URL,
useValue: environment.urlPrefix
}
],
bootstrap: [AppComponent]
})
export class AppModule { }