Skip to content

Commit

Permalink
fixup!: apply feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jannyHou committed Feb 21, 2020
1 parent 4fde3f3 commit 4de8c3e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/access-control-migration/src/keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

import {BindingKey} from '@loopback/context';
import {TokenService, UserService} from '@loopback/authentication';
import {BindingKey} from '@loopback/context';
import {User} from './models';
import {Credentials} from './services/user.service';

export namespace TokenServiceConstants {
export const TOKEN_SECRET_VALUE = 'myjwts3cr3t';
export const TOKEN_EXPIRES_IN_VALUE = '600';
export const TOKEN_EXPIRES_IN_VALUE = '21600';
}

export namespace TokenServiceBindings {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import {inject, Provider} from '@loopback/core';
import * as casbin from 'casbin';
const debug = require('debug')('loopback:example:acl');
const DEFAULT_SCOPE = 'execute';

// Class level authorizer
export class CasbinAuthorizationProvider implements Provider<Authorizer> {
Expand Down Expand Up @@ -41,7 +42,7 @@ export class CasbinAuthorizationProvider implements Provider<Authorizer> {
const request: AuthorizationRequest = {
subject,
object,
action: (metadata.scopes && metadata.scopes[0]) || 'execute',
action: (metadata.scopes && metadata.scopes[0]) || DEFAULT_SCOPE,
};

const allowedRoles = metadata.allowedRoles;
Expand Down Expand Up @@ -77,7 +78,7 @@ export class CasbinAuthorizationProvider implements Provider<Authorizer> {

// Generate the user name according to the naming convention
// in casbin policy
// A use's name would be `u${id}`
// A user's name would be `u${id}`
getUserName(id: number): string {
return `u${id}`;
}
Expand Down

0 comments on commit 4de8c3e

Please sign in to comment.