How to use @delon/auth - 10 common examples

To help you get started, we’ve selected a few @delon/auth examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github personball / abplus-zero-template / angular / src / app / core / auth / app-auth.service.ts View on Github external
.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));
  }
github dotnetcore / OSharp / tests / web / ui / ng-alain7 / src / app / delon.module.ts View on Github external
export function fnDelonAuthConfig(): DelonAuthConfig {
  return {
    ...new DelonAuthConfig(),
    ...{ login_url: '/passport/login', ignores: [/\/login/, /assets\//, /api\/(?!admin)[\w_-]+\/\S*/] } as DelonAuthConfig
  };
}
github dotnetcore / OSharp / tests / web / ui / ng-alain8 / src / app / delon.module.ts View on Github external
export function fnDelonAuthConfig(): DelonAuthConfig {
  return {
    ...new DelonAuthConfig(),
    login_url: '/passport/login',
    ignores: [
      /assets\//,
      /passport\//,
      /api\/(?!admin)[\w_-]+\/\S*/
    ]
  };
}
github dotnetcore / OSharp / tests / web / ui / ng-alain8 / src / app / core / net / refresh-jwt.interceptor.ts View on Github external
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) {
github personball / abplus-zero-template / angular / src / app / delon.module.ts View on Github external
export function fnDelonAuthConfig(): DelonAuthConfig {
  return {
    ...new DelonAuthConfig(),
    ...{
      login_url: '/passport/login',
      executeOtherInterceptors: false
    } as DelonAuthConfig
  };
}
github dotnetcore / OSharp / samples / web / ui-clients / ng-alain8 / src / app / delon.module.ts View on Github external
export function fnDelonAuthConfig(): DelonAuthConfig {
  return {
    ...new DelonAuthConfig(),
    login_url: '/passport/login',
    ignores: [
      /assets\//,
      /passport\//,
      /api\/(?!admin)[\w_-]+\/\S*/
    ]
  };
}
github dotnetcore / OSharp / samples / web / ui-clients / ng-alain8 / src / app / core / net / refresh-jwt.interceptor.ts View on Github external
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) {
github dotnetcore / Util / sample / Util.Samples.Angular.AntDesign / Typings / app / delon.module.ts View on Github external
export function fnDelonAuthConfig(): DelonAuthConfig {
  return {
    ...new DelonAuthConfig(),
    ...{ login_url: '/passport/login' } as DelonAuthConfig
  };
}
github ZhouRenYou / ng-deerway / src / app / app.module.ts View on Github external
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 { }

@delon/auth

Simple user authentication, support Json Web Token & Simple Token.

MIT
Latest version published 3 days ago

Package Health Score

85 / 100
Full package analysis