Package com.sk89q.skmcl.session

Examples of com.sk89q.skmcl.session.YggdrasilSession$AuthenticateResponse


            this.password = password;
        }

        @Override
        public Identity call() throws AuthenticationException, IOException, InterruptedException {
            YggdrasilSession session = new YggdrasilSession(account.getId());
            session.setPassword(password);
            session.verify();

            List<Identity> identities = session.getIdentities();

            // The list of identities (profiles in Mojang terms) corresponds to whether the account
            // owns the game, so we need to check that
            if (identities.size() > 0) {
                account.setIdentities(identities);
View Full Code Here


    PasswordCredentials passwordCredentials = new PasswordCredentials();
    passwordCredentials.setUsername(username);
    passwordCredentials.setPassword(password);

    // TODO: Cache auth tokens??
    AuthenticateResponse response = keystoneUserClient.authenticate(passwordCredentials);
    PlatformlayerAuthenticationToken authToken = new PlatformlayerAuthenticationToken(response.getAccess());

    return authToken;

    // // TODO: Cache decoded tokens?
    // KeystoneAuthentication auth = (KeystoneAuthentication) keystoneSystemClient.validate(
View Full Code Here

    auth.setPasswordCredentials(passwordCredentials);

    AuthenticateRequest request = new AuthenticateRequest();
    request.setAuth(auth);

    AuthenticateResponse response;
    try {
      response = doSimpleXmlRequest(HttpMethod.POST, "api/tokens", request, AuthenticateResponse.class);
    } catch (RestClientException e) {
      Integer httpResponseCode = e.getHttpResponseCode();
      if (httpResponseCode != null && httpResponseCode == 401) {
View Full Code Here

    request.setAuth(auth);

    final KeyManager keyManager = new SimpleClientCertificateKeyManager(privateKey, certificateChain);

    for (int i = 0; i < 2; i++) {
      AuthenticateResponse response;
      try {
        RestfulRequest<AuthenticateResponse> httpRequest = httpClient.buildRequest(HttpMethod.POST,
            "api/tokens", HttpPayload.asXml(request), AuthenticateResponse.class);

        httpRequest.setKeyManager(keyManager);

        response = httpRequest.execute();
      } catch (RestClientException e) {
        throw new PlatformlayerAuthenticationClientException("Error authenticating", e);
      }

      if (i == 0) {
        if (response == null || response.getChallenge() == null) {
          return null;
        }

        byte[] challenge = response.getChallenge();
        byte[] challengeResponse = decrypt(privateKey, challenge);
        certificateCredentials.setChallengeResponse(challengeResponse);
      } else {
        if (response == null || response.getAccess() == null) {
          return null;
        }
        return new PlatformlayerAuthenticationToken(response.getAccess());
      }
    }

    return null;
  }
View Full Code Here

    if (token == null) {
      PasswordCredentials passwordCredentials = new PasswordCredentials();
      passwordCredentials.setUsername(username);
      passwordCredentials.setPassword(password);

      AuthenticateResponse response = client.authenticate(passwordCredentials);
      token = new PlatformlayerAuthenticationToken(response.getAccess());
    }
    return token;
  }
View Full Code Here

TOP

Related Classes of com.sk89q.skmcl.session.YggdrasilSession$AuthenticateResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.