Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'oidc-provider' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.
const app = express()
// Determine whether to run in local mode
localTest = !(process.env.APIGEE_ORGANIZATION);
const oidcURL = (localTest) ? "http://localhost:9000" : process.env.OIDC_URL || ("https://" + process.env.APIGEE_ORGANIZATION + "-" + process.env.APIGEE_ENVIRONMENT + ".apigee.net");
// Add required user info claims. These are hardcoded in this function
configuration.findAccount = account.findAccount;
configuration.findById = account.findById;
const oidc = new Provider(oidcURL, configuration)
app.set('views', path.join(__dirname, 'views'))
app.set('view engine', 'ejs')
Provider.useRequest()
let server
(async() => {
await oidc.initialize({
clients
})
app.get('/', (req, res) => res.send('Welcome to the Apigee OIDC Mock - Local version'))
routes(app, oidc)
app.use(oidc.callback)
app.enable('trust proxy')
oidc.proxy = true
server = app.listen(process.env.PORT || 9000, function() {
console.log('Listening on port %d', server.address().port)
const fs = require('fs');
const { createKeyStore } = require('oidc-provider');
const certificateKeystore = createKeyStore();
const integrityKeystore = createKeyStore();
const logger = require('../lib/logger');
logger.info('Generating keys. This will take a few seconds...');
Promise.all([
certificateKeystore.generate('RSA', 2048, {
kid: 'sig-rs-0',
use: 'sig',
}),
certificateKeystore.generate('RSA', 2048, {
kid: 'enc-rs-0',
use: 'enc',
}),
certificateKeystore.generate('EC', 'P-256', {
kid: 'sig-ec2-0',
use: 'sig',
}),
const generateKeys = () => {
const keystore = createKeyStore()
return Promise.all([['RSA', 2048], ['EC', 'P-256'], ['EC', 'P-384'], ['EC', 'P-521']]
.map(([v0, v1]) => keystore.generate(v0, v1)))
.then(() => promisify(fs.writeFile)(
path.resolve(__dirname, './keystore.json'),
JSON.stringify(keystore.toJSON(true), null, 2)
))
}
const keystorePromise = (async () => {
const keystore = OIDCProvider.createKeyStore();
await Promise.all([
keystore.generate('RSA', 2048, { alg: 'RS256', use: 'sig' }),
keystore.generate('EC', 'P-256', { kid: 'enc-ec2-0', use: 'sig' })
]);
return keystore;
})();
const Logger = require('@basaas/node-logger');
const fs = require('fs');
const path = require('path');
const { createKeyStore } = require('oidc-provider');
const conf = require('../../conf');
const keystore = createKeyStore();
const log = Logger.getLogger(`${conf.general.loggingNameSpace}/keystore`, {
level: 'debug',
});
const keyStorePath = conf.oidc.keystorePath || path.join(__dirname, '../../../', 'keystore/keystore.json');
const generate = async (keySize) => {
try {
await Promise.all([
keystore.generate('RSA', keySize, {
kid: 'sig-rs-0',
use: 'sig',
}),
const fs = require('fs');
const { createKeyStore } = require('oidc-provider');
const certificateKeystore = createKeyStore();
const integrityKeystore = createKeyStore();
const logger = require('../lib/logger');
logger.info('Generating keys. This will take a few seconds...');
Promise.all([
certificateKeystore.generate('RSA', 2048, {
kid: 'sig-rs-0',
use: 'sig',
}),
certificateKeystore.generate('RSA', 2048, {
kid: 'enc-rs-0',
use: 'enc',
}),
certificateKeystore.generate('EC', 'P-256', {
kid: 'sig-ec2-0',
use: 'sig',