Configuring and Running P4OAuth

The current setup of P4OAuth is fairly manual:

  1. Download the latest version here:

    • Open the files tab
    • Download the p4oauth-VERSION.jar file
  2. Put the binary in a "working folder"

  3. Prepare a Java keystore file (see below for a self-signed mechanism)

  4. Create a P4OAuth.yml configuration file (see below)

  5. Create a whitelist configuration file (see below)

  6. Launch P4OAuth: java -jar p4oauth.jar P4OAuth.yml

Create A self-signed Java keystore file

Here's an example of using the keytool command that we currently use to prepare environments automatically:

keytool -genkeypair -dname "cn=Developer, ou=Engineering, o=Perforce, c=US" \
    -alias business -keypass password -keystore keystore -storepass password \
    -validity 180

It's run in the working directly, and sets up a simple keystore with the key
and store passwords set to password.

For more information on keytool please see the official documentation from Oracle.

Create a P4OAuth.yml file

Here's an example P4OAuth.yml file used for testing:

!com.perforce.workshop.tjuricek.p4oauth.config.P4OAuthConfig
keyStorePath:         /Users/tjuricek/dev/workshop/p4oauth/functional_tests/build/keystore
keyStorePassword:     password
keyManagerPassword:   password
hostname:             dhcp-141-n100.dhcp.perforce.com
rootDirectory:        /Users/tjuricek/dev/workshop/p4oauth/functional_tests/build/p4oauth

perforce: !com.perforce.workshop.tjuricek.p4oauth.config.PerforceConfig
    hostname: 127.0.0.1
    port: 1666

Please note that this is mapped pretty directly to the Java class P4OAuthConfig. Please refer to the javaDoc for more details.

Create the whitelist configuration file

Here's another example file used for testing:

servers:
  - !com.perforce.workshop.tjuricek.p4oauth.models.WhitelistedServer
    name: test_server
    redirectUri: https://dhcp-141-n100.dhcp.perforce.com:8444/handle
    ipAddress: 127.0.0.1

Please note this is also mapped to a single Java class Whitelist. Please refer to the javadoc for more details.