Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@entur-partner/permission-client-node
Advanced tools
Javascript modul som tilbyr en cache av bruker rettigheter fra Permission Store.
npm install @entur-partner/permission-client-node
# alternativt yarn add auth0 @entur-partner/permission-client-node
Planlegger en å motta WebSocket push meldinger trengs følgende pakkener:
yarn add @stomp/stompjs websocket
I tillegg trengs det å kjøre følgende ved oppstart av tjenesten:
Object.assign(global, { WebSocket: require('websocket').w3cwebsocket });
Benyttes for å hente ut access tokens from Auth0 ved bruk av klient id og klient hemmelighet (Auth0 Clients)
import {TokenOptions, TokenFactory} from '@entur-partner/permission-client-node'
const clientTokenOptions : TokenOptions = {
domain: 'internal.dev.entur.org',
clientId: '<clientId>',
clientSecret: '<secret>',
audience: 'https://api.dev.entur.io',
refreshBeforeMinValidSeconds: 600 // getAccessToken() vil fornye token den retuner, når acess token er gyldig i mindre enn 10 minutter.
}
const accessTokenFactory = new TokenFactory(clientTokenOptions);
// Eksempel bruk av TokenFactory
const accessToken = await accessTokenFactory.getAccessToken();
Ønsker en å sjekke hvilke rettigheter en bruker har i Permission Store benyttes PermissionClient.
import {AuthorizeCacheType, Application, ApplicationPermission, PermissionDeliverRepository} from '@entur-partner/permission-client-node'
import PermissionClient from '@entur-partner/permission-client-node'
const application : Application = {
name : 'TestApplication',
refreshRate : 300 // Hvert 5 minutt sjekkes Permission Store for endringer
}
const permissionStoreUrl = new URL('https://api.dev.entur.io/permission-store/v1');
const repository = new PermissionDeliverRepository(application, accessTokenFactory, permissionStoreUrl);
// Definerer rettigheter som benyttes av tjenesten
const applicationpermissions : ApplicationPermission[] = [];
applicationpermissions.push({operation: 'produkt', access: 'les'});
applicationpermissions.push({operation: 'produkt', access: 'les', responsibilityType: null});
applicationpermissions.push({operation: 'produkt', access: 'les', responsibilityType: 'produkt.organisation'});
applicationpermissions.push({operation: 'produkt', access: 'les', responsibilityType: 'produkt.id'});
// Ved bruk at poll skriv følgende:
const autorizeCache = await PermissionClient(AuthorizeCacheType.IN_MEMORY, applicationpermissions, repository);
// Optional for å benytte WebSocket. NB! Pass på at angitt permissionStoreUrl støtter WebSocket og ikke går via APIGEE
// const autorizeCache = await PermissionClient(AuthorizeCacheType.IN_MEMORY, applicationpermissions, repository, { communicationType: CommunicationType.SocketJS });
// autorizeCache are ready to be used like:
const hasBCAccess = autorizeCache.checkBusinessCapabilityPermission(authoritySubject, businessCapability);
const hasRSAccess = autorizeCache.checkResponsibilitySetPermission(authoritySubject, responsibilitySet);
const userPermissions = getPermissions(authoritySubject);
Clone modulen fra Bitbucket med:
git clone https://<username>@bitbucket.org/enturas/permission-client-node.git
Innstaller avhengigeter fra konsoll på roten av prosjektet:
npm install
Enhetstester utviklet i Jest kjøres ned:
npm test
Oppgrader versjon
npm version <major | minor | patch>
Opprett en NPM user account på https://www.npmjs.com/signup. Send brukeren din til tech-lead i Entur Partner og be om å bli lagt til i Entur Partner organisation.
Publisering utføres ved å skrive:
npm publish
FAQs
Node client library for Permission Store
The npm package @entur-partner/permission-client-node receives a total of 271 weekly downloads. As such, @entur-partner/permission-client-node popularity was classified as not popular.
We found that @entur-partner/permission-client-node demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.