Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions lib/identity-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,16 +515,32 @@ IdentityProvider.prototype.post = function (req, res, next) {
debug('Create account with settings ', options)

waterfall([
function (callback) {
if (options.spkac && options.spkac.length > 0) {
spkac = new Buffer(stripLineEndings(options.spkac), 'utf-8')
webid('tls').generate({
spkac: spkac,
agent: agent // TODO generate agent
}, callback)
} else {
(callback) => {
if (this.auth !== 'oidc') {
return callback()
}

const oidc = req.app.locals.oidc
return oidc.client.users
.create({
email: options.email,
profile: agent,
name: options.name,
password: options.password
})
.then(() => callback())
.catch(callback)
},
(callback) => {
if (!(this.auth === 'tls' && options.spkac && options.spkac.length > 0)) {
return callback(null, false)
}

spkac = new Buffer(stripLineEndings(options.spkac), 'utf-8')
webid('tls').generate({
spkac: spkac,
agent: agent // TODO generate agent
}, callback)
},
function (newCert, callback) {
cert = newCert
Expand Down