Skip to content

Instantly share code, notes, and snippets.

Last active Jul 12, 2021
What would you like to do?
Add\remove user automatically to JFrog from a triggered github webhook call
exports.handler = async (event, context, callback) => {
baseJFrogURL = '',
request = event.Records[0].cf.request,
body = request.body;
switch (body.action) {
case 'added':
const orgEmailAddress = useJeffUserQueryHere(body.member.login) // Your place to shine!
const payload = {
"schemas": [
"userName": orgEmailAddress,
"active": true,
"internalPasswordDisabled": true,
"admin": true, // Need to figure out from where to fetch this one?
"emails": [
"value": orgEmailAddress,
"primary": true
"groups": [
"readers",, // As long as our names are the same!
`${}-admin` // If admin!
const response = await fetch(`${baseJFrogURL}/api/v1/scim/v2/Users`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
}, body: JSON.stringify(payload),
}).then(res => res.ok ? res.json : false)
return callback(null, response);
case 'removed':
// Probably the same as above

This comment has been minimized.

Copy link

@cuperman cuperman commented Jul 9, 2021

oh interesting idea. you want us to use github as the source of truth for our users, and automatically propagate users to our other cloud tools?


This comment has been minimized.

Copy link
Owner Author

@evilUrge evilUrge commented Jul 12, 2021

Indeed, then again, as we're managing users via Azure-AD, maybe it makes more sense to trigger the same from AD based on the user's security groups

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment