How to use the taskcluster-client.Auth function in taskcluster-client

To help you get started, we’ve selected a few taskcluster-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github taskcluster / taskcluster / libraries / testing / src / mockauth.js View on Github external
}, function(req, res) {
  // Get parameters
  var account = req.params.account;
  var table   = req.params.table;
  var ctx     = this;

  // Check that the client is authorized to access given account and table
  if (!req.satisfies({account: account, table: table})) {
    return;
  }

  // Check that the account exists
  if (!ctx.azureAccounts[account]) {
    // Try to fetch from auth, if not specified directly
    var auth = new taskcluster.Auth({
      credentials:      ctx.credentials,
      baseUrl:          ctx.authBaseUrl
    });
    return auth.azureTableSAS(account, table).then(function(result) {
      return res.reply(result);
    }, function() {
      return res.status(404).json({
        message:    "Account '" + account + "' not found, can't delegate access"
      });
    });
  }

  // Construct client
  var client = azureTable.createClient({
    accountName:    account,
    accountKey:     ctx.azureAccounts[account],
github taskcluster / taskcluster-tools / src / auth / roles / rolemanager.jsx View on Github external
import React from 'react';
import {Row, Col, ButtonToolbar, Button, Glyphicon, Table} from 'react-bootstrap';
import RoleEditor from './roleeditor';
import * as utils from '../../lib/utils';
import taskcluster from 'taskcluster-client';
import _ from 'lodash';

import './rolemanager.less';

/** Create role manager */
const RoleManager = React.createClass({
  /** Initialize mixins */
  mixins: [
    utils.createTaskClusterMixin({
      clients: {
        auth: taskcluster.Auth,
      },
    }),
    // Serialize state.selectedRoleId to location.hash as string
    utils.createLocationHashMixin({
      keys: ['selectedRoleId'],
      type: 'string',
    }),
  ],

  /** Create an initial state */
  getInitialState() {
    return {
      rolesLoaded: false,
      rolesError: undefined,
      roles: undefined,
      selectedRoleId: '',   // '' means "add new role"
github taskcluster / taskcluster-tools / src / auth / scopes / scopeinspector.jsx View on Github external
import * as utils from '../../lib/utils';
import taskcluster from 'taskcluster-client';
import * as format from '../../lib/format';
import _ from 'lodash';
import RoleEditor from '../roles/roleeditor';
import ClientEditor from '../clients/clienteditor';
import './scopeinspector.less';

export default React.createClass({
  displayName: 'ScopeInspector',

  /** Initialize mixins */
  mixins: [
    utils.createTaskClusterMixin({
      clients: {
        auth: taskcluster.Auth,
      },
    }),
    // Serialize selectedScope and selectedEntity to location.hash as string
    utils.createLocationHashMixin({
      keys: ['selectedScope', 'selectedEntity'],
      type: 'string',
    }),
  ],

  /** Create an initial state */
  getInitialState() {
    return {
      rolesLoaded: false,
      rolesError: null,
      roles: null,
      clientsLoaded: false,
github taskcluster / taskcluster / services / auth / bin / make-check-client.js View on Github external
const taskcluster = require('taskcluster-client');

if (!module.parent) {
  // use the root credentials from the environment (this is meant to be run from `heroku run`)
  let auth = new taskcluster.Auth({
    baseUrl: 'https://taskcluster-auth-staging.herokuapp.com/v1/',
    credentials: {
      clientId: 'root',
      accessToken: process.env.ROOT_ACCESS_TOKEN,
    },
  });

  // invent a client name
  let clientId = 'project/taskcluster/tc-auth/staging-check/' + taskcluster.slugid();

  auth.createClient(clientId, {
    expires: new Date(3000, 1, 1),
    description: 'test credentials for checkStaging',
    scopes: [
      'auth:create-client:garbage/*',
      'auth:delete-client:garbage/*',
github taskcluster / taskcluster / services / web-server / src / main.js View on Github external
setup: async ({ cfg, strategies, monitor }, ownName) => {
        const auth = new Auth({
          credentials: cfg.taskcluster.credentials,
          rootUrl: cfg.taskcluster.rootUrl,
        });
        return monitor.oneShot(ownName, () => scanner(auth, strategies));
      },
    },
github taskcluster / taskcluster / services / web-server / src / main.js View on Github external
      setup: ({ cfg }) => new taskcluster.Auth(cfg.taskcluster),
    },
github taskcluster / taskcluster / services / web-server / src / main.js View on Github external
      setup: ({ cfg }) => new taskcluster.Auth(cfg.taskcluster),
    },
github taskcluster / taskcluster / services / web-server / src / clients.js View on Github external
module.exports = options => ({
  auth: new Auth(options),
  github: new Github(options),
  hooks: new Hooks(options),
  index: new Index(options),
  purgeCache: new PurgeCache(options),
  queue: new Queue(options),
  secrets: new Secrets(options),
  queueEvents: new QueueEvents(options),
  notify: new Notify(options),
  workerManager: new WorkerManager(options),
});