summaryrefslogtreecommitdiffstats
path: root/openstack-examples/src/main/java/com/woorea/openstack/examples/hpcloud/KeystoneAuthentication.java
blob: 1caffea6e0bd219de85f9f165fd32ea00830da95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package com.woorea.openstack.examples.hpcloud;


import com.woorea.openstack.examples.ExamplesConfiguration;
import com.woorea.openstack.keystone.Keystone;
import com.woorea.openstack.keystone.model.Access;

public class KeystoneAuthentication {

  private static final String KEYSTONE_AUTH_URL = "https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0";

  /**
   * @param args
   */
  public static void main(String[] args) {
    Keystone keystone = new Keystone(KEYSTONE_AUTH_URL);

    // access with unscoped token
    Access access = keystone
        .tokens()
        .authenticate()
        .withUsernamePassword(ExamplesConfiguration.KEYSTONE_USERNAME, ExamplesConfiguration.KEYSTONE_PASSWORD)
        .execute();

    System.out.println(access);

  }

}