Stores authorization token passed as an argument.
@param token Token instance to be stored.
@param envKey Environment key for token.
13462
@Override
    public void store(OAuthToken token, String envKey) {
        FileOutputStream fileOut;
        try {
            fileOut = new FileOutputStream(getFilePath(envKey));
            ObjectOutputStream out = new ObjectOutputStream(fileOut);
            out.writeObject(token);
            out.close();
            fileOut.close();
        } catch (Exception ex) {
            Logger.getLogger(FileStorageStrategy.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
196158
public void disableOAuth1AccessToken(DbxOAuth1AccessToken token)
        throws DbxException
    {
        if (token == null) throw new IllegalArgumentException("'token' can't be null");
        DbxRequestUtil.doPostNoAuth(
            requestConfig,
            DbxClientV1.USER_AGENT_ID,
            appInfo.getHost().getApi(),
            "1/disable_access_token",
            null,
            getHeaders(token),
            new DbxRequestUtil.ResponseHandler<Void>() {
                @Override
                public Void handle(HttpRequestor.Response response) throws DbxException {
                    if (response.getStatusCode() != 200) throw DbxRequestUtil.unexpectedStatus(response);
                    return null;
                }
            }
        );
    }
386824
public void setAccesskey(java.lang.String accesskey) {
        getStateHelper().put(PropertyKeys.accesskey, accesskey);
        handleAttribute("accesskey", accesskey);
    }
1203046
def process(self, request, response, environ):
        
        data = self.authorize(request, response, environ,
                              self.scope_handler.scopes)

        if isinstance(data, Response):
            return data

        code = self.token_generator.generate()
        expires = int(time.time()) + self.token_expiration

        auth_code = AuthorizationCode(client_id=self.client.identifier,
                                      code=code, expires_at=expires,
                                      redirect_uri=self.client.redirect_uri,
                                      scopes=self.scope_handler.scopes,
                                      data=data[0], user_id=data[1])

        self.auth_code_store.save_code(auth_code)

        response.add_header("Location", self._generate_location(code))
        response.body = ""
        response.status_code = 302

        return response
816232
public void setCredential(String username, String password) {
	if (username != null) {
	    env.put("java.naming.security.principal", username);
	    env.put("java.naming.security.credentials", password);
	}
	else {
	    env.remove("java.naming.security.principal");
	    env.remove("java.naming.security.credentials");
	}
    }
531508
public function setAuthToken($tenantKey, $authToken, $authTokenExpiration)
    {
        if ($this->tenantTokens[$tenantKey] == null) {
            $this->tenantTokens[$tenantKey] = array();
        }
        $this->tenantTokens[$tenantKey]['authToken'] = $authToken;
        $this->tenantTokens[$tenantKey]['authTokenExpiration'] = $authTokenExpiration;
    }
264602
def save_token(self, access_token):
        
        self.access_tokens[access_token.token] = access_token

        unique_token_key = self._unique_token_key(access_token.client_id,
                                                  access_token.grant_type,
                                                  access_token.user_id)

        self.unique_token_identifier[unique_token_key] = access_token.token

        if access_token.refresh_token is not None:
            self.refresh_tokens[access_token.refresh_token] = access_token

        return True
906639
@Deprecated
    public void setAccessToken(String token) {
        checkUserSession("setAccessToken");
        synchronized (this.lock) {
            accessToken = token;
            lastAccessUpdateMillisecondsAfterEpoch = System.currentTimeMillis();
            sessionInvalidated = true;
        }
    }
1137484
function(token) {
        this.oauthClient.setCredentials(token);
        this.brain.set(this.TOKEN_KEY, token.access_token);
        if (token.refresh_token) {
            this.brain.set(this.REFRESH_KEY, token.refresh_token);
        }
        this.brain.set(this.EXPIRY_KEY, +token.expiry_date);
        this.brain.save();
        this.brain.resetSaveInterval(60);
    }
778942
public void store(Auth token) throws IOException {
        this.auths.put(token.getUser().getId(), token);
        this.authsByUser.put(token.getUser().getUsername(), token);

        String filename = token.getUser().getId() + ".auth";
        File outFile = new File(this.authStoreDir, filename);
        outFile.createNewFile();

        ObjectOutputStream authStream = new ObjectOutputStream(new FileOutputStream(outFile));
        authStream.writeObject(token);
        authStream.flush();
        authStream.close();
    }
323003
public void setToken(Token v) {
    if (Event_Type.featOkTst && ((Event_Type)jcasType).casFeat_token == null)
      jcasType.jcas.throwFeatMissing("token", "de.unihd.dbs.uima.types.heideltime.Event");
    jcasType.ll_cas.ll_setRefValue(addr, ((Event_Type)jcasType).casFeatCode_token, jcasType.ll_cas.ll_getFSRef(v));}
38572
public static final void signAuthToken(AuthToken token) {
        String signature = generateSignature(token);
        token.setSignature(signature);
    }
795542
def authorization_middleware(environ, start_response=None):
    '''
    '''
    key = 'http.authorization'
    c = environ.get(key)
    if c is None:
        code = 'HTTP_AUTHORIZATION'
        if code in environ:
            environ[key] = parse_authorization_header(environ[code])
871044
@Override
  public void saveAuthorizedClient(
      OAuth2AuthorizedClient authorizedClient, Authentication principal) {
    Assert.notNull(authorizedClient, "authorizedClient cannot be null");
    Assert.notNull(principal, "principal cannot be null");
    this.authorizedClients.put(
        this.getIdentifier(authorizedClient.getClientRegistration(), principal.getName()),
        authorizedClient);
  }
117172
private void saveTokenFromResponse(Response response) {
        try {
            JSONObject responseJSON = ((ResponseImpl)response).getResponseJSON();

            String accessToken = responseJSON.getString("access_token");
            String idToken = responseJSON.getString("id_token");

            //save the tokens
            preferences.accessToken.set(accessToken);
            preferences.idToken.set(idToken);

            //save the user identity separately
            String[] idTokenData = idToken.split("\\.");
            byte[] decodedIdTokenData = Base64.decode(idTokenData[1], Base64.DEFAULT);
            String decodedIdTokenString = new String(decodedIdTokenData);
            JSONObject idTokenJSON = new JSONObject(decodedIdTokenString);

            if (idTokenJSON.has("imf.user")) {
                preferences.userIdentity.set(idTokenJSON.getJSONObject("imf.user"));
            }

            logger.debug("token successfully saved");
        } catch (Exception e) {
            throw new RuntimeException("Failed to save token from response", e);
        }
    }
418839
def set_token(self):
        
        super(UserPassCredentials, self).set_token()
        try:
            token = self._context.acquire_token_with_username_password(
                self.resource,
                self.username,
                self.password,
                self.id
            )
            self.token = self._convert_token(token)
        except adal.AdalError as err:
            raise_with_traceback(AuthenticationError, "", err)
1311577
public void putPasswordResetToken(final RequestContext requestContext, final String token) {
        val flowScope = requestContext.getFlowScope();
        flowScope.put(FLOWSCOPE_PARAMETER_NAME_TOKEN, token);
    }