Пример #1
0
    refreshTimestamps: function (task) {
      // Take a taskcluster task and make all of the timestamps
      // new again. This is pretty much lifted verbatim from
      // mozilla_ci_tools which was used by pulse_actions.
      // We need to do this because action tasks are created with
      // timestamps for expires/created/deadline that are based
      // on the time of the original decision task creation. We must
      // update to the current time, or Taskcluster will reject the
      // task upon creation.
      task.expires = fromNow('366 days');
      task.created = fromNow(0);
      task.deadline = fromNow('1 day');

      _.map(task.payload.artifacts, function (artifact) {
        artifact.expires = fromNow('365 days');
      });

      return task;
    },
Пример #2
0
export function userSessionFromAuthResult(authResult) {
  return UserSession.fromOIDC({
    oidcProvider: 'mozilla-auth0',
    accessToken: authResult.accessToken,
    fullName: authResult.idTokenPayload.nickname,
    picture: authResult.idTokenPayload.picture,
    oidcSubject: authResult.idTokenPayload.sub,
    // per https://wiki.mozilla.org/Security/Guidelines/OpenID_connect#Session_handling
    renewAfter: fromNow('15 minutes')
  });
}
Пример #3
0
export const userSessionFromAuthResult = authResult => {
  const expiresAt = JSON.stringify(authResult.expiresIn * 1000 + Date.now());
  const userSession = {
    idToken: authResult.idToken,
    accessToken: authResult.accessToken,
    fullName: authResult.idTokenPayload.nickname,
    picture: authResult.idTokenPayload.picture,
    oidcSubject: authResult.idTokenPayload.sub,
    url: authResult.url,
    // expiresAt is used by the django backend to expire the user session
    expiresAt,
    // per https://wiki.mozilla.org/Security/Guidelines/OpenID_connect#Session_handling
    renewAfter: fromNow('15 minutes'),
  };

  return userSession;
};
Пример #4
0
 _.map(task.payload.artifacts, function (artifact) {
   artifact.expires = fromNow('365 days');
 });