-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #124 from vtsykun/oauth2
GitHub/GitLab integration
- Loading branch information
Showing
104 changed files
with
4,710 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# OAuth2 and Sync integrations | ||
|
||
## Base configuration | ||
|
||
To enable OAuth2 integrations you need to add following configuration | ||
```yml | ||
packeton: | ||
integrations: | ||
github: # Alias name | ||
allow_login: true # default false | ||
allow_register: true # default false | ||
default_roles: ['ROLE_USER', 'ROLE_MAINTAINER', 'ROLE_GITLAB'] | ||
login_title: Login or Register with GitHub | ||
clone_preference: 'api' | ||
repos_synchronization: true | ||
# webhook_url: 'https://packeton.google.dev/' - overwrite host when setup webhooks | ||
github: | ||
client_id: 'xxx' | ||
client_secret: 'xxx' | ||
|
||
gitlab2: # Alias name - may be any url safe value. | ||
base_url: 'https://gitlab.production.com/' | ||
clone_preference: 'clone_https' # Allows [api, clone_https, clone_ssh] | ||
gitlab: # Provider name: github, gitlab, bitbucket etc | ||
client_id: 'xxx' | ||
client_secret: 'xxx' | ||
api_version: 'v4' # you may overwrite only for gitlab provider, default v4 | ||
``` | ||
|
||
Where `clone_preference`: | ||
|
||
- `api` - Use api to get composer info | ||
- `clone_https` - clone repo with using oauth api token | ||
- `clone_ssh` - clone repo with system ssh key | ||
|
||
`repos_synchronization` - If enabled, a new package will be automatically created when you will push to a new or exists repo that contains `composer.json` | ||
|
||
## Supported 3-d provider | ||
|
||
### GitHub | ||
|
||
Scopes: | ||
|
||
- login: `user:email` | ||
- repositories: `read:org`, `repo` | ||
|
||
Redirect Urls: | ||
|
||
``` | ||
https://example.com/ | ||
``` | ||
|
||
### GitLab | ||
|
||
Scopes: | ||
|
||
- login: `read_user` | ||
- repositories: `api` | ||
|
||
Redirect Urls: | ||
|
||
``` | ||
https://example.com/oauth2/{alias}/install | ||
https://example.com/oauth2/{alias}/check | ||
``` | ||
|
||
#### GitLab Groups Webhooks notices | ||
|
||
A group webhooks needed for synchronization a new package. | ||
They are triggered by events that occur across all projects in the group. | ||
This feature enabled only for Premium / EE / Gold paid plan, but it can be replaced with GitLab Packagist Integration | ||
|
||
You must manually setup this integration. | ||
|
||
[![Gitlab](img/gitlab.png)](img/gitlab.png) | ||
|
||
Where token you can find on the packeton integration view page. The token must have `whk` prefix | ||
to find related integration access token. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
(function ($, humane) { | ||
"use strict"; | ||
let connBtn = $('.connect'); | ||
|
||
connBtn.on('click', (e) => { | ||
|
||
e.preventDefault(); | ||
let el = $(e.currentTarget); | ||
let btn = el.find('.btn') | ||
btn.addClass('loading'); | ||
let url = el.attr('href'); | ||
|
||
let options = { | ||
type: 'POST', | ||
url: url, | ||
data: { | ||
'token': el.attr('data-token'), | ||
'org': el.attr('data-org') | ||
}, | ||
|
||
success: (data) => { | ||
btn.removeClass('loading'); | ||
if (data['connected']) { | ||
btn.removeClass('btn-primary'); | ||
btn.addClass('btn-danger'); | ||
btn.html('Discontent'); | ||
} else { | ||
btn.removeClass('btn-danger'); | ||
btn.addClass('btn-primary'); | ||
btn.html('Connect'); | ||
} | ||
}, | ||
error: (err) => { | ||
btn.removeClass('loading'); | ||
console.log(err); | ||
}, | ||
always: () => { | ||
btn.removeClass('loading'); | ||
} | ||
}; | ||
|
||
$.ajax(options); | ||
}); | ||
})(jQuery, humane); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(function () { | ||
"use strict"; | ||
let el = document.getElementById('route'); | ||
let route = el.getAttribute('href'); | ||
|
||
setTimeout(() => { | ||
location.href = route; | ||
}, 500); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,7 +119,6 @@ | |
wrap.select2({'data': result}); | ||
wrap.html(options.join('')).change(); | ||
wrap.val(prev); | ||
|
||
} | ||
} | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.