screwdriver-api 8.0.174 → 8.0.176
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/server.js +14 -2
- package/package.json +1 -1
- package/plugins/auth/index.js +85 -4
- package/plugins/auth/login.js +12 -0
- package/plugins/auth/token.js +4 -1
- package/plugins/builds/token.js +3 -0
- package/plugins/pipelines/admins/get.js +14 -3
- package/plugins/pipelines/admins/list.js +5 -0
- package/plugins/pipelines/batchUpdateAdmins.js +5 -0
- package/plugins/pipelines/caches/delete.js +5 -0
- package/plugins/pipelines/caches/request.js +4 -1
- package/plugins/pipelines/create.js +5 -0
- package/plugins/pipelines/get.js +5 -0
- package/plugins/pipelines/lastSuccessfulEvent.js +5 -0
- package/plugins/pipelines/latestBuild.js +5 -0
- package/plugins/pipelines/latestCommitEvent.js +5 -0
- package/plugins/pipelines/list.js +5 -0
- package/plugins/pipelines/listBuilds.js +5 -0
- package/plugins/pipelines/listEvents.js +5 -0
- package/plugins/pipelines/listJobs.js +5 -0
- package/plugins/pipelines/listSecrets.js +5 -0
- package/plugins/pipelines/listStages.js +5 -0
- package/plugins/pipelines/listTriggers.js +5 -0
- package/plugins/pipelines/metrics.js +5 -0
- package/plugins/pipelines/openPr.js +5 -0
- package/plugins/pipelines/remove.js +5 -0
- package/plugins/pipelines/startAll.js +5 -0
- package/plugins/pipelines/sync.js +5 -0
- package/plugins/pipelines/syncPRs.js +5 -0
- package/plugins/pipelines/syncWebhooks.js +5 -0
- package/plugins/pipelines/templates/create.js +5 -0
- package/plugins/pipelines/templates/createTag.js +5 -0
- package/plugins/pipelines/templates/get.js +5 -0
- package/plugins/pipelines/templates/getTemplateById.js +5 -0
- package/plugins/pipelines/templates/getVersion.js +5 -0
- package/plugins/pipelines/templates/list.js +5 -0
- package/plugins/pipelines/templates/listTags.js +5 -0
- package/plugins/pipelines/templates/listVersions.js +5 -0
- package/plugins/pipelines/templates/remove.js +5 -0
- package/plugins/pipelines/templates/removeTag.js +5 -0
- package/plugins/pipelines/templates/removeVersion.js +5 -0
- package/plugins/pipelines/templates/updateTrusted.js +5 -0
- package/plugins/pipelines/tokens/create.js +5 -0
- package/plugins/pipelines/tokens/list.js +5 -0
- package/plugins/pipelines/tokens/refresh.js +5 -0
- package/plugins/pipelines/tokens/remove.js +5 -0
- package/plugins/pipelines/tokens/removeAll.js +5 -0
- package/plugins/pipelines/tokens/update.js +5 -0
- package/plugins/pipelines/update.js +5 -0
- package/plugins/pipelines/updateAdmins.js +5 -0
- package/plugins/pipelines/updateBuildCluster.js +5 -0
- package/plugins/users/get.js +7 -1
package/lib/server.js
CHANGED
|
@@ -227,7 +227,13 @@ module.exports = async config => {
|
|
|
227
227
|
server.app.buildFactory.apiUri = server.info.uri;
|
|
228
228
|
server.app.buildFactory.tokenGen = (buildId, metadata, scmContext, expiresIn, scope = ['temporal']) =>
|
|
229
229
|
server.plugins.auth.generateToken(
|
|
230
|
-
server.plugins.auth.generateProfile({
|
|
230
|
+
server.plugins.auth.generateProfile({
|
|
231
|
+
username: buildId,
|
|
232
|
+
scmContext,
|
|
233
|
+
scope,
|
|
234
|
+
auth: { type: 'temporary' },
|
|
235
|
+
metadata
|
|
236
|
+
}),
|
|
231
237
|
expiresIn
|
|
232
238
|
);
|
|
233
239
|
server.app.buildFactory.executor.tokenGen = server.app.buildFactory.tokenGen;
|
|
@@ -236,7 +242,13 @@ module.exports = async config => {
|
|
|
236
242
|
server.app.jobFactory.apiUri = server.info.uri;
|
|
237
243
|
server.app.jobFactory.tokenGen = (username, metadata, scmContext, scope = ['user']) =>
|
|
238
244
|
server.plugins.auth.generateToken(
|
|
239
|
-
server.plugins.auth.generateProfile({
|
|
245
|
+
server.plugins.auth.generateProfile({
|
|
246
|
+
username,
|
|
247
|
+
scmContext,
|
|
248
|
+
scope,
|
|
249
|
+
auth: { type: 'temporary' },
|
|
250
|
+
metadata
|
|
251
|
+
})
|
|
240
252
|
);
|
|
241
253
|
server.app.jobFactory.executor.userTokenGen = server.app.jobFactory.tokenGen;
|
|
242
254
|
|
package/package.json
CHANGED
package/plugins/auth/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const boom = require('@hapi/boom');
|
|
3
4
|
const joi = require('joi');
|
|
4
5
|
const jwt = require('jsonwebtoken');
|
|
5
6
|
const { v4: uuidv4 } = require('uuid');
|
|
@@ -94,6 +95,64 @@ const authPlugin = {
|
|
|
94
95
|
async register(server, options) {
|
|
95
96
|
const pluginOptions = joi.attempt(options, AUTH_PLUGIN_SCHEMA, 'Invalid config for plugin-auth');
|
|
96
97
|
|
|
98
|
+
server.ext('onPostAuth', async (request, h) => {
|
|
99
|
+
const { tokenFactory } = request.server.app;
|
|
100
|
+
|
|
101
|
+
const permissionLevels = {
|
|
102
|
+
read: 1,
|
|
103
|
+
execute: 2,
|
|
104
|
+
write: 3,
|
|
105
|
+
all: 4
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const authSettings = request.route.settings.plugins ? request.route.settings.plugins.authorization : null;
|
|
109
|
+
|
|
110
|
+
if (!authSettings) {
|
|
111
|
+
return h.continue;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (!request.auth.isAuthenticated) {
|
|
115
|
+
throw boom.unauthorized();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const credentials = request.auth.credentials;
|
|
119
|
+
|
|
120
|
+
if (!credentials.auth || credentials.auth.type !== 'api_token') {
|
|
121
|
+
return h.continue;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const apiTokenId = credentials.auth.apiTokenId;
|
|
125
|
+
|
|
126
|
+
if (!apiTokenId) {
|
|
127
|
+
throw boom.forbidden(`Your token is invalid`);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const token = await tokenFactory.get({ id: apiTokenId });
|
|
131
|
+
|
|
132
|
+
if (!token) {
|
|
133
|
+
throw boom.forbidden(`Your token is invalid`);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (token.expiresAt && new Date(token.expiresAt) < new Date()) {
|
|
137
|
+
throw boom.forbidden(`Your token is expired: token id ${apiTokenId}`);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const actualPermission = credentials.permission || 'all';
|
|
141
|
+
const requiredPermission = authSettings.permission;
|
|
142
|
+
const actualPermissionLevel = permissionLevels[actualPermission];
|
|
143
|
+
const requiredPermissionLevel = permissionLevels[requiredPermission];
|
|
144
|
+
|
|
145
|
+
if (!requiredPermissionLevel) {
|
|
146
|
+
throw boom.badImplementation(`Invalid required permission: "${requiredPermission}"`);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (!actualPermissionLevel || actualPermissionLevel < requiredPermissionLevel) {
|
|
150
|
+
throw boom.forbidden(`This endpoint requires "${requiredPermission}" permission`);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return h.continue;
|
|
154
|
+
});
|
|
155
|
+
|
|
97
156
|
/**
|
|
98
157
|
* Generates a profile for storage in cookie and jwt
|
|
99
158
|
* @method generateProfile
|
|
@@ -102,12 +161,22 @@ const authPlugin = {
|
|
|
102
161
|
* @param {String} config.scmUserId User ID in the SCM
|
|
103
162
|
* @param {String} config.scmContext Scm to which the person logged in belongs
|
|
104
163
|
* @param {Array} config.scope Scope for this profile (usually build or user)
|
|
164
|
+
* @param {Object} config.auth Authentication method information
|
|
165
|
+
* @param {Object} config.options Additional token options
|
|
105
166
|
* @param {Object} config.metadata Additional information to tag along with the login
|
|
106
167
|
* @return {Object} The profile to be stored in jwt and/or cookie
|
|
107
168
|
*/
|
|
108
169
|
server.expose('generateProfile', config => {
|
|
109
|
-
const { username, scmUserId, scmContext, scope, metadata } = config;
|
|
110
|
-
const profile = {
|
|
170
|
+
const { username, scmUserId, scmContext, scope, auth, options: profileOptions, metadata } = config;
|
|
171
|
+
const profile = {
|
|
172
|
+
username,
|
|
173
|
+
scmContext,
|
|
174
|
+
scmUserId,
|
|
175
|
+
scope,
|
|
176
|
+
auth,
|
|
177
|
+
...(profileOptions || {}),
|
|
178
|
+
...(metadata || {})
|
|
179
|
+
};
|
|
111
180
|
|
|
112
181
|
if (pluginOptions.jwtEnvironment) {
|
|
113
182
|
profile.environment = pluginOptions.jwtEnvironment;
|
|
@@ -228,7 +297,13 @@ const authPlugin = {
|
|
|
228
297
|
username: user.username,
|
|
229
298
|
scmUserId: scmUser.id,
|
|
230
299
|
scmContext: user.scmContext,
|
|
231
|
-
scope: ['user']
|
|
300
|
+
scope: ['user'],
|
|
301
|
+
auth: {
|
|
302
|
+
type: 'api_token',
|
|
303
|
+
apiTokenId: token.id,
|
|
304
|
+
apiTokenType: 'user'
|
|
305
|
+
},
|
|
306
|
+
...(token.options || {})
|
|
232
307
|
};
|
|
233
308
|
|
|
234
309
|
const scmDisplayName = scm.getDisplayName({ scmContext: profile.scmContext });
|
|
@@ -256,7 +331,13 @@ const authPlugin = {
|
|
|
256
331
|
username: admin.username,
|
|
257
332
|
scmContext: pipeline.scmContext,
|
|
258
333
|
pipelineId: token.pipelineId,
|
|
259
|
-
scope: ['pipeline']
|
|
334
|
+
scope: ['pipeline'],
|
|
335
|
+
auth: {
|
|
336
|
+
type: 'api_token',
|
|
337
|
+
apiTokenId: token.id,
|
|
338
|
+
apiTokenType: 'pipeline'
|
|
339
|
+
},
|
|
340
|
+
...(token.options || {})
|
|
260
341
|
};
|
|
261
342
|
}
|
|
262
343
|
if (!profile) {
|
package/plugins/auth/login.js
CHANGED
|
@@ -35,6 +35,12 @@ function addGuestRoute(config) {
|
|
|
35
35
|
const profile = request.server.plugins.auth.generateProfile({
|
|
36
36
|
username,
|
|
37
37
|
scope: ['user', 'guest'],
|
|
38
|
+
auth: {
|
|
39
|
+
type: 'temporary'
|
|
40
|
+
},
|
|
41
|
+
options: {
|
|
42
|
+
permission: 'read'
|
|
43
|
+
},
|
|
38
44
|
metadata: {}
|
|
39
45
|
});
|
|
40
46
|
|
|
@@ -92,6 +98,12 @@ function addOAuthRoutes(config) {
|
|
|
92
98
|
scmUserId,
|
|
93
99
|
scmContext,
|
|
94
100
|
scope: ['user'],
|
|
101
|
+
auth: {
|
|
102
|
+
type: 'oauth'
|
|
103
|
+
},
|
|
104
|
+
options: {
|
|
105
|
+
permission: 'all'
|
|
106
|
+
},
|
|
95
107
|
metadata: {}
|
|
96
108
|
});
|
|
97
109
|
const scmDisplayName = await userFactory.scm.getDisplayName({ scmContext });
|
package/plugins/auth/token.js
CHANGED
|
@@ -45,7 +45,10 @@ module.exports = () => ({
|
|
|
45
45
|
profile = request.server.plugins.auth.generateProfile({
|
|
46
46
|
username: request.params.buildId,
|
|
47
47
|
scmContext: pipeline.scmContext,
|
|
48
|
-
scope: ['build', 'impersonated']
|
|
48
|
+
scope: ['build', 'impersonated'],
|
|
49
|
+
auth: {
|
|
50
|
+
type: 'temporary'
|
|
51
|
+
}
|
|
49
52
|
});
|
|
50
53
|
profile.token = request.server.plugins.auth.generateToken(profile);
|
|
51
54
|
|
package/plugins/builds/token.js
CHANGED
|
@@ -18,13 +18,18 @@ module.exports = () => ({
|
|
|
18
18
|
strategies: ['token'],
|
|
19
19
|
scope: ['user', 'admin', 'pipeline', '!guest']
|
|
20
20
|
},
|
|
21
|
+
plugins: {
|
|
22
|
+
authorization: {
|
|
23
|
+
permission: 'read'
|
|
24
|
+
}
|
|
25
|
+
},
|
|
21
26
|
|
|
22
27
|
handler: async (request, h) => {
|
|
23
28
|
const { pipelineFactory } = request.server.app;
|
|
24
|
-
const { scope } = request.auth.credentials;
|
|
29
|
+
const { scope, permission = 'all' } = request.auth.credentials;
|
|
25
30
|
const { scmContext, includeUserToken } = request.query;
|
|
26
31
|
|
|
27
|
-
if (includeUserToken && !scope.includes('admin')) {
|
|
32
|
+
if (includeUserToken && (!scope.includes('admin') || permission !== 'all')) {
|
|
28
33
|
throw boom.forbidden('Only Screwdriver admin is allowed to request user token');
|
|
29
34
|
}
|
|
30
35
|
|
|
@@ -44,7 +49,13 @@ module.exports = () => ({
|
|
|
44
49
|
const profile = request.server.plugins.auth.generateProfile({
|
|
45
50
|
username: admin.username,
|
|
46
51
|
scmContext: admin.scmContext,
|
|
47
|
-
scope: ['user']
|
|
52
|
+
scope: ['user'],
|
|
53
|
+
auth: {
|
|
54
|
+
type: 'temporary'
|
|
55
|
+
},
|
|
56
|
+
options: {
|
|
57
|
+
permission: 'all'
|
|
58
|
+
}
|
|
48
59
|
});
|
|
49
60
|
|
|
50
61
|
admin.userToken = request.server.plugins.auth.generateToken(profile);
|
|
@@ -85,6 +85,11 @@ module.exports = () => ({
|
|
|
85
85
|
strategies: ['token'],
|
|
86
86
|
scope: ['user', 'admin']
|
|
87
87
|
},
|
|
88
|
+
plugins: {
|
|
89
|
+
authorization: {
|
|
90
|
+
permission: 'read'
|
|
91
|
+
}
|
|
92
|
+
},
|
|
88
93
|
|
|
89
94
|
handler: async (request, h) => {
|
|
90
95
|
const { pipelineFactory, userFactory } = request.server.app;
|
|
@@ -18,6 +18,11 @@ module.exports = () => ({
|
|
|
18
18
|
strategies: ['token'],
|
|
19
19
|
scope: ['user', '!guest', 'admin']
|
|
20
20
|
},
|
|
21
|
+
plugins: {
|
|
22
|
+
authorization: {
|
|
23
|
+
permission: 'all'
|
|
24
|
+
}
|
|
25
|
+
},
|
|
21
26
|
handler: async (request, h) => {
|
|
22
27
|
const { scmContext, username, scope } = request.auth.credentials;
|
|
23
28
|
const { payload } = request;
|
|
@@ -21,6 +21,11 @@ module.exports = () => ({
|
|
|
21
21
|
strategies: ['token'],
|
|
22
22
|
scope: ['user', 'pipeline', '!guest']
|
|
23
23
|
},
|
|
24
|
+
plugins: {
|
|
25
|
+
authorization: {
|
|
26
|
+
permission: 'write'
|
|
27
|
+
}
|
|
28
|
+
},
|
|
24
29
|
|
|
25
30
|
handler: async (request, h) => {
|
|
26
31
|
const { pipelineFactory, userFactory } = request.server.app;
|
|
@@ -19,6 +19,11 @@ module.exports = () => ({
|
|
|
19
19
|
strategies: ['token'],
|
|
20
20
|
scope: ['user', '!guest']
|
|
21
21
|
},
|
|
22
|
+
plugins: {
|
|
23
|
+
authorization: {
|
|
24
|
+
permission: 'all'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
22
27
|
|
|
23
28
|
handler: async (request, h) => {
|
|
24
29
|
const checkoutUrl = formatCheckoutUrl(request.payload.checkoutUrl);
|
package/plugins/pipelines/get.js
CHANGED
|
@@ -17,6 +17,11 @@ module.exports = () => ({
|
|
|
17
17
|
strategies: ['token'],
|
|
18
18
|
scope: ['user', 'build', 'pipeline']
|
|
19
19
|
},
|
|
20
|
+
plugins: {
|
|
21
|
+
authorization: {
|
|
22
|
+
permission: 'read'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
20
25
|
|
|
21
26
|
handler: async (request, h) => {
|
|
22
27
|
const { canAccessPipeline } = request.server.plugins.pipelines;
|
|
@@ -17,6 +17,11 @@ module.exports = () => ({
|
|
|
17
17
|
strategies: ['token'],
|
|
18
18
|
scope: ['user', 'build', 'pipeline']
|
|
19
19
|
},
|
|
20
|
+
plugins: {
|
|
21
|
+
authorization: {
|
|
22
|
+
permission: 'read'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
20
25
|
|
|
21
26
|
handler: async (request, h) => {
|
|
22
27
|
const factory = request.server.app.pipelineFactory;
|
|
@@ -31,6 +31,11 @@ module.exports = () => ({
|
|
|
31
31
|
strategies: ['token'],
|
|
32
32
|
scope: ['user', 'build', 'pipeline']
|
|
33
33
|
},
|
|
34
|
+
plugins: {
|
|
35
|
+
authorization: {
|
|
36
|
+
permission: 'read'
|
|
37
|
+
}
|
|
38
|
+
},
|
|
34
39
|
|
|
35
40
|
handler: async (request, h) => {
|
|
36
41
|
const factory = request.server.app.pipelineFactory;
|
|
@@ -19,6 +19,11 @@ module.exports = () => ({
|
|
|
19
19
|
strategies: ['token'],
|
|
20
20
|
scope: ['user', 'build', 'pipeline']
|
|
21
21
|
},
|
|
22
|
+
plugins: {
|
|
23
|
+
authorization: {
|
|
24
|
+
permission: 'read'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
22
27
|
|
|
23
28
|
handler: async (request, h) => {
|
|
24
29
|
const { pipelineFactory } = request.server.app;
|
|
@@ -17,6 +17,11 @@ module.exports = () => ({
|
|
|
17
17
|
strategies: ['token'],
|
|
18
18
|
scope: ['user', 'pipeline', '!guest']
|
|
19
19
|
},
|
|
20
|
+
plugins: {
|
|
21
|
+
authorization: {
|
|
22
|
+
permission: 'read'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
20
25
|
|
|
21
26
|
handler: async (request, h) => {
|
|
22
27
|
const { pipelineFactory } = request.server.app;
|
|
@@ -19,6 +19,11 @@ module.exports = () => ({
|
|
|
19
19
|
strategies: ['token'],
|
|
20
20
|
scope: ['user', 'build', 'pipeline']
|
|
21
21
|
},
|
|
22
|
+
plugins: {
|
|
23
|
+
authorization: {
|
|
24
|
+
permission: 'read'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
22
27
|
|
|
23
28
|
handler: async (request, h) => {
|
|
24
29
|
const { pipelineFactory, stageFactory } = request.server.app;
|
|
@@ -27,6 +27,11 @@ module.exports = () => ({
|
|
|
27
27
|
strategies: ['token'],
|
|
28
28
|
scope: ['user', 'build', 'pipeline']
|
|
29
29
|
},
|
|
30
|
+
plugins: {
|
|
31
|
+
authorization: {
|
|
32
|
+
permission: 'read'
|
|
33
|
+
}
|
|
34
|
+
},
|
|
30
35
|
|
|
31
36
|
handler: async (request, h) => {
|
|
32
37
|
const { pipelineFactory, triggerFactory } = request.server.app;
|
|
@@ -25,6 +25,11 @@ module.exports = () => ({
|
|
|
25
25
|
strategies: ['token'],
|
|
26
26
|
scope: ['user', '!guest', 'pipeline']
|
|
27
27
|
},
|
|
28
|
+
plugins: {
|
|
29
|
+
authorization: {
|
|
30
|
+
permission: 'read'
|
|
31
|
+
}
|
|
32
|
+
},
|
|
28
33
|
|
|
29
34
|
handler: async (request, h) => {
|
|
30
35
|
const factory = request.server.app.pipelineFactory;
|
|
@@ -17,6 +17,11 @@ module.exports = () => ({
|
|
|
17
17
|
strategies: ['token'],
|
|
18
18
|
scope: ['user', '!guest']
|
|
19
19
|
},
|
|
20
|
+
plugins: {
|
|
21
|
+
authorization: {
|
|
22
|
+
permission: 'all'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
20
25
|
|
|
21
26
|
handler: async (request, h) => {
|
|
22
27
|
const { pipelineFactory, bannerFactory } = request.server.app;
|
|
@@ -18,6 +18,11 @@ module.exports = () => ({
|
|
|
18
18
|
strategies: ['token'],
|
|
19
19
|
scope: ['user', '!guest']
|
|
20
20
|
},
|
|
21
|
+
plugins: {
|
|
22
|
+
authorization: {
|
|
23
|
+
permission: 'execute'
|
|
24
|
+
}
|
|
25
|
+
},
|
|
21
26
|
|
|
22
27
|
handler: async (request, h) => {
|
|
23
28
|
const { pipelineFactory, userFactory } = request.server.app;
|
|
@@ -16,6 +16,11 @@ module.exports = () => ({
|
|
|
16
16
|
strategies: ['token'],
|
|
17
17
|
scope: ['build']
|
|
18
18
|
},
|
|
19
|
+
plugins: {
|
|
20
|
+
authorization: {
|
|
21
|
+
permission: 'all'
|
|
22
|
+
}
|
|
23
|
+
},
|
|
19
24
|
handler: async (request, h) => {
|
|
20
25
|
const { pipelineTemplateVersionFactory, pipelineTemplateFactory } = request.server.app;
|
|
21
26
|
|
|
@@ -17,6 +17,11 @@ module.exports = () => ({
|
|
|
17
17
|
strategies: ['token'],
|
|
18
18
|
scope: ['user', 'build']
|
|
19
19
|
},
|
|
20
|
+
plugins: {
|
|
21
|
+
authorization: {
|
|
22
|
+
permission: 'read'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
20
25
|
handler: async (request, h) => {
|
|
21
26
|
const { namespace, name } = request.params;
|
|
22
27
|
const { pipelineTemplateFactory } = request.server.app;
|
|
@@ -18,6 +18,11 @@ module.exports = () => ({
|
|
|
18
18
|
strategies: ['token'],
|
|
19
19
|
scope: ['user', 'build']
|
|
20
20
|
},
|
|
21
|
+
plugins: {
|
|
22
|
+
authorization: {
|
|
23
|
+
permission: 'read'
|
|
24
|
+
}
|
|
25
|
+
},
|
|
21
26
|
handler: async (request, h) => {
|
|
22
27
|
const { namespace, name, versionOrTag } = request.params;
|
|
23
28
|
const { pipelineTemplateFactory, pipelineTemplateVersionFactory, pipelineTemplateTagFactory } =
|
|
@@ -16,6 +16,11 @@ module.exports = () => ({
|
|
|
16
16
|
strategies: ['token'],
|
|
17
17
|
scope: ['user', 'build']
|
|
18
18
|
},
|
|
19
|
+
plugins: {
|
|
20
|
+
authorization: {
|
|
21
|
+
permission: 'read'
|
|
22
|
+
}
|
|
23
|
+
},
|
|
19
24
|
|
|
20
25
|
handler: async (request, h) => {
|
|
21
26
|
const { pipelineTemplateTagFactory } = request.server.app;
|
|
@@ -21,6 +21,11 @@ module.exports = () => ({
|
|
|
21
21
|
strategies: ['token'],
|
|
22
22
|
scope: ['user', 'build']
|
|
23
23
|
},
|
|
24
|
+
plugins: {
|
|
25
|
+
authorization: {
|
|
26
|
+
permission: 'read'
|
|
27
|
+
}
|
|
28
|
+
},
|
|
24
29
|
handler: async (request, h) => {
|
|
25
30
|
const { pipelineTemplateFactory, pipelineTemplateVersionFactory } = request.server.app;
|
|
26
31
|
const config = {
|
|
@@ -17,6 +17,11 @@ module.exports = () => ({
|
|
|
17
17
|
strategies: ['token'],
|
|
18
18
|
scope: ['build', 'user', '!guest']
|
|
19
19
|
},
|
|
20
|
+
plugins: {
|
|
21
|
+
authorization: {
|
|
22
|
+
permission: 'all'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
20
25
|
|
|
21
26
|
handler: async (request, h) => {
|
|
22
27
|
const { namespace, name, version } = request.params;
|
|
@@ -20,6 +20,11 @@ module.exports = () => ({
|
|
|
20
20
|
strategies: ['token'],
|
|
21
21
|
scope: ['user', '!guest']
|
|
22
22
|
},
|
|
23
|
+
plugins: {
|
|
24
|
+
authorization: {
|
|
25
|
+
permission: 'all'
|
|
26
|
+
}
|
|
27
|
+
},
|
|
23
28
|
|
|
24
29
|
handler: async (request, h) => {
|
|
25
30
|
const { pipelineFactory, tokenFactory, userFactory } = request.server.app;
|
|
@@ -18,6 +18,11 @@ module.exports = () => ({
|
|
|
18
18
|
strategies: ['token'],
|
|
19
19
|
scope: ['user', '!guest']
|
|
20
20
|
},
|
|
21
|
+
plugins: {
|
|
22
|
+
authorization: {
|
|
23
|
+
permission: 'read'
|
|
24
|
+
}
|
|
25
|
+
},
|
|
21
26
|
|
|
22
27
|
handler: async (request, h) => {
|
|
23
28
|
const { pipelineFactory, userFactory } = request.server.app;
|
|
@@ -19,6 +19,11 @@ module.exports = () => ({
|
|
|
19
19
|
strategies: ['token'],
|
|
20
20
|
scope: ['user', '!guest']
|
|
21
21
|
},
|
|
22
|
+
plugins: {
|
|
23
|
+
authorization: {
|
|
24
|
+
permission: 'all'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
22
27
|
|
|
23
28
|
handler: async (request, h) => {
|
|
24
29
|
const { pipelineFactory, userFactory, tokenFactory } = request.server.app;
|
|
@@ -19,6 +19,11 @@ module.exports = () => ({
|
|
|
19
19
|
strategies: ['token'],
|
|
20
20
|
scope: ['user', '!guest']
|
|
21
21
|
},
|
|
22
|
+
plugins: {
|
|
23
|
+
authorization: {
|
|
24
|
+
permission: 'all'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
22
27
|
|
|
23
28
|
handler: async (request, h) => {
|
|
24
29
|
const { tokenFactory, pipelineFactory, userFactory } = request.server.app;
|
|
@@ -17,6 +17,11 @@ module.exports = () => ({
|
|
|
17
17
|
strategies: ['token'],
|
|
18
18
|
scope: ['user', '!guest']
|
|
19
19
|
},
|
|
20
|
+
plugins: {
|
|
21
|
+
authorization: {
|
|
22
|
+
permission: 'all'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
20
25
|
|
|
21
26
|
handler: async (request, h) => {
|
|
22
27
|
const { pipelineFactory, userFactory } = request.server.app;
|
|
@@ -18,6 +18,11 @@ module.exports = () => ({
|
|
|
18
18
|
strategies: ['token'],
|
|
19
19
|
scope: ['user', '!guest']
|
|
20
20
|
},
|
|
21
|
+
plugins: {
|
|
22
|
+
authorization: {
|
|
23
|
+
permission: 'all'
|
|
24
|
+
}
|
|
25
|
+
},
|
|
21
26
|
|
|
22
27
|
handler: async (request, h) => {
|
|
23
28
|
const { tokenFactory, userFactory, pipelineFactory } = request.server.app;
|
|
@@ -74,6 +74,11 @@ module.exports = () => ({
|
|
|
74
74
|
strategies: ['token'],
|
|
75
75
|
scope: ['user', '!guest', 'pipeline']
|
|
76
76
|
},
|
|
77
|
+
plugins: {
|
|
78
|
+
authorization: {
|
|
79
|
+
permission: 'all'
|
|
80
|
+
}
|
|
81
|
+
},
|
|
77
82
|
|
|
78
83
|
handler: async (request, h) => {
|
|
79
84
|
const { checkoutUrl, rootDir, settings, badges, state, stateChangeMessage } = request.payload;
|
|
@@ -17,6 +17,11 @@ module.exports = () => ({
|
|
|
17
17
|
strategies: ['token'],
|
|
18
18
|
scope: ['user', '!guest', 'admin']
|
|
19
19
|
},
|
|
20
|
+
plugins: {
|
|
21
|
+
authorization: {
|
|
22
|
+
permission: 'all'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
20
25
|
handler: async (request, h) => {
|
|
21
26
|
const { id } = request.params;
|
|
22
27
|
const { scmContext, username, scope } = request.auth.credentials;
|
|
@@ -17,6 +17,11 @@ module.exports = () => ({
|
|
|
17
17
|
strategies: ['token'],
|
|
18
18
|
scope: ['user', '!guest']
|
|
19
19
|
},
|
|
20
|
+
plugins: {
|
|
21
|
+
authorization: {
|
|
22
|
+
permission: 'all'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
20
25
|
handler: async (request, h) => {
|
|
21
26
|
const buildClusterAnnotation = 'screwdriver.cd/buildCluster';
|
|
22
27
|
const { payload } = request;
|
package/plugins/users/get.js
CHANGED
|
@@ -42,7 +42,13 @@ module.exports = () => ({
|
|
|
42
42
|
const profile = request.server.plugins.auth.generateProfile({
|
|
43
43
|
username: user.username,
|
|
44
44
|
scmContext: user.scmContext,
|
|
45
|
-
scope: ['user']
|
|
45
|
+
scope: ['user'],
|
|
46
|
+
auth: {
|
|
47
|
+
type: 'temporary'
|
|
48
|
+
},
|
|
49
|
+
options: {
|
|
50
|
+
permission: 'all'
|
|
51
|
+
}
|
|
46
52
|
});
|
|
47
53
|
|
|
48
54
|
user.userToken = request.server.plugins.auth.generateToken(profile);
|