LATEST VERSION: 1.7 - RELEASE NOTES
Single Sign-On v1.7

Updating Service Plans with UAAC

This topic describes how Pivotal Cloud Foundry (PCF) administrators manage Single Sign-On (SSO) service plans using the User Account and Authentication Command Line Interface (UAAC)

The SSO service for PCF manages configurations within the UAA and the Cloud Controller (CC) components of the Pivotal Application Service (formerly Elastic Runtime). Each SSO service plan ties together a CC plan and a UAA identity zone.

Beginning with SSO v1.6, you can use the UAAC to manage UAA identity zones configured as part of SSO service plans.

Create a UAA Identity Zone Admin Client

To use the UAAC with your SSO service plan, you need an identity zone admin client. To create the identity zone admin client, you need to create an admin client that corresponds to your SSO service plan.

Create an Admin Client

To create an UAA admin client, do the following:

  1. Follow the procedure in Create an Admin Client.

  2. Using the instructions above, give this client the clients.admin scope.

  3. Record the App ID and App Secret. You need these for the procedure below.

Create a UAA Identity Zone Admin Client

To create a UAAC idenity zone admin client, do the following:

  1. Install the UAAC as follows:

    gem install cf-uaac
    

    For information about the UAAC, see the UAAC Github Repository.

  2. Use the UAAC to target your service plan:

    uaac target MY-AUTH-DOMAIN.login.example.com
    

    Where:
    MY-AUTH-DOMAIN is the Auth Domain you entered when you created the Service Plan.

  3. Run the command below to authenticate and obtain an access token for the admin client for your service plan. UAAC stores the token in ~/.uaac.yml.

    uaac token client get MY-APP-ID -s MY-APP-SECRET
    

    Where:

    • MY-APP-ID is your admin app ID.
    • MY-APP-SECRET is your app secret.

    Use the App ID and App Secret provided when you created the admin client in the procedure above.

  4. Run the following command to display your client context and verify that you have clients.admin under the scope section.

    uaac context 
    

    For example:

    $ uaac context
    [1]*[ExampleAppID]
      client_id: ExampleAppID
        access_token: aBcdEfg0hIJKlm123.e
        token_type: bearer
        expires_in: 43200
        scope: uaa.resource clients.admin
        jti: 91b3-abcd1233
    

  5. Run the following command to create an identity zone admin client.

    uaac client add ZONE-ADMIN-CLIENT-ID --authorized_grant_types client_credentials --authorities uaa.admin
    

    Where:

    • ZONE-ADMIN-CLIENT-ID is an ID you want to use to identify this zone admin client.

    When prompted for a New client secret, provide a client secret for this identity zone admin client. Make sure to use a secure value for your client secret.

    For example:

    $ uaac client add ExampleZoneAdminClientID --authorized_grant_types client_credentials --authorities uaa.admin
    New client secret:  *****
    Verify new client secret:  *****
    

    Record the values you provide for ZONE-ADMIN-CLIENT-ID and New client secret.

    You can delete the original admin client created via the SSO UI after you create the identity zone client.

  6. Run the following command to authenticate and obtain an access token for the identity zone admin client for your service plan.

    uaac token client get ZONE-ADMIN-CLIENT-ID
    

    Where:

    • ZONE-ADMIN-CLIENT-ID is zone admin client ID you provided in the previous step.

    When prompted for a Client secret, use the client secret you provided in the previous step.

    For example:

    $ uaac token client get ExampleZoneAdminClientID
    Client secret:  *****
    

  7. Use the following command to display your client context and verify that you have uaa.admin under the scope section.

    uaac context 
    

    For example:

    $ uaac context
    [1]*[ExampleZoneAdminClientID]
    client_id: ExampleZoneAdminClientID
      access_token: asdioqwuelk12312.e21e
      token_type: bearer
      expires_in: 43200
      scope: uaa.admin
      jti: 123908dkl1-23298
    
    You can now do operator level API configurations for the SSO service plan. You do not have permissions for any other SSO service plan.

Update UAA Identity Zone Configurations with the API

This section shows how to use the UAAC to update UAA identity zone configurations, using a PUT command.

WARNING: This flow is for advanced users only. You must always run the PUT command with the latest data by doing a GET before a PUT command. You must also provide all configuration values, otherwise, data may be lost.

For general information about UAA API, see the CF UAA API documentation page .

To make UAA identity zone API calls, do the following:

  1. Create an identity zone admin client following Create a UAA Identity Zone Admin Client above.
  2. Run the following command, directing the output to a text file:
    uaac curl -k /identity-zones/ZONE-ADMIN-CLIENT-ID > JSON-BLOB.txt
    Where:
  3. In the JSON-BLOB.txt file, delete the header information and array wrapper, leaving just the JSON blob. Confirm that the ID in this output matches ZONE-ADMIN-CLIENT-ID.

    Your remaining JSON blob looks similar to the truncated sample below:
    {
      "id": "demo",
      "subdomain": "demo",
      "config": {
        "clientSecretPolicy": {
        "minLength": -1,
        "maxLength": -1,
        "requireUpperCaseCharacter": -1,
        "requireLowerCaseCharacter": -1,
        "requireDigit": -1,
        "requireSpecialCharacter": -1
        },
        ...
      },
      "name": "demo",
      "version": 2,
      "description": "{\"plan_display_name\":\"demo\",
      \"plan_description\":\"Demo Service Plan\"}",
      "created": 1510116389000,
      "last_modified": 1519859509000
    }
    
  4. In your JSON-BLOB.txt update the configurations in the JSON blob as needed, and then save the file.

    WARNING: You must provide all config values, otherwise, data can be lost when doing an API update as a PUT command.

  5. Submit a UAAC curl request to apply your updated configurations to the identity zone, as shown below.

    WARNING: You must always run this command with the latest data by doing a GET before a PUT command.

    uaac curl -k /identity-zones/ZONE-ADMIN-CLIENT-ID -X PUT 
    \-H 'Content-Type: application/json' -d "$(cat file.txt)"
    Where: A truncated example command would look similar to the following:
    $ uaac curl -k identity-zones/demo\
             -X PUT \
             -H 'Content-Type: application/json' \
             -d '{
                  "subdomain": "demo",
                  "config": {
                    "clientSecretPolicy": {
                      "minLength": 0,
                      "maxLength": 255,
                      "requireUpperCaseCharacter": 0,
                      "requireLowerCaseCharacter": 0,
                      "requireDigit": 0,
                      "requireSpecialCharacter": 0
                   },
                   ...
                 },
                 "name": "demo",
                 "version": 0,
                 "description": "{\"plan\_display\_name\":\"demo\",
                 \"plan\_description\":\"Demo Service Plan\"}",
                 "created" : 1529690485998,
                 "last_modified" : 1529690485998
               }
         
For a full list of UAA API update parameters, see the Identity Zones Update Documentation.

Modify Branding

You can optionally modify the branding of your login page by changing your company name, logos, legal text, and legal links.

Using the steps in Update UAA Identity Zone Configurations with the API above to retrieve the identity zone configurations for your SSO plan, add or modify the branding section according to the UAA API documentation.

An example branding section is shown below.

Note: All values are optional. You can also generate the base64 text of your PNG images using commands, such as base64 image.png.

"branding": {
      "companyName": "Pivotal",
      "productLogo": "(base64 of png image here, will show up as image on login page)",
      "squareLogo": "(base64 of png image here, will show up as browser icon)",
      "footerLegalText": "©2017 Pivotal Software, Inc. All Rights Reserved.",
      "footerLinks": {
        "Privacy Policy": "https://run.pivotal.io/policies/privacy-policy/",
        "Terms of Service": "https://run.pivotal.io/policies/terms-of-service",
        "Up to three links, label here": "https://link-here"
      }
    },

Add Default Groups for Users

Optionally, you can add additional default groups for all users. You do not need to do manual group assignment or group mappings for these groups. Use default groups only for universal scopes that all users can have, such as for a global read-only resource.

Using the steps in Update UAA Identity Zone Configurations with the API to retrieve and update the current identity zone configurations for your SSO plan, update the default groups section according to the UAA API documentation.

An example of the default groups section is shown below. You can add more groups in the array list. Users will automatically have these scopes though they are not explicitly assigned to users.
"userConfig": {
      "defaultGroups": [
        "openid",
        "password.write",
        "uaa.user",
        "approvals.me",
        "profile",
        "roles",
        "user_attributes",
        "uaa.offline_token",
        "new.group.everyone.should.have",
        "another.new.group.everyone.should.have"
      ]
    },

Rotate JSON Web Token (JWT) Signing Keys

To rotate JWT signing keys, do the following:

  1. Generate a private key that can be used for signing. For example, run ssh-keygen -t rsa.

    Generate your signing keys in a secure manner. Refer to your security organization for acceptable key generation practices.

  2. Take the value of the generated private key and make it a single line of text, replacing all new lines with \n. For example:

    -----BEGIN RSA PRIVATE KEY----- MIIEogIBAAKCAQEA63iy3EpQG46eRzUKpI8sB/AQdbZwwrDkfPGg5Xt5xNM/wQrO 5l/yWp3lCElSqnKPJbCGu1DQThB47kGQjBoXL8TcrkxuCyuxaV7B5ryq3w+g3R1x -----END RSA PRIVATE KEY-----


    Becomes:

    -----BEGIN RSA PRIVATE KEY-----\nMIIEogIBAAKCAQEA63iSAMPLEzUKpI8sB/AQdbZwwrDkSAMPLEt5xNM/wQrO\n5l/yWp3lCElSqnKSAMPLE8TcrkxuCyuxaV7B5ryq3w+g3R1x\n-----END RSA PRIVATE KEY-----\n
    
  3. Using the steps in Update UAA Identity Zone Configurations with the API above to retrieve and update the identity zone configurations for your SSO plan, update the token policy section to add your new generated private key as the value for signingKey.

    An example of this section is shown below.

    Note: After you begin to configure JWT signing keys within a service plan, you can no longer default to share the multi-tenant JWT signing key inherited from the default zone.

    Note: The first time you set a signing key for an identity zone, existing issued tokens are immediately invalidated for online validation. You may need to restart applications that do offline validation for the new signing keys to take effect.

     "tokenPolicy": {
      "accessTokenValidity": -1,
      "refreshTokenValidity": -1,
      "jwtRevocable": false,
      "refreshTokenUnique": false,
      "refreshTokenFormat": "jwt",
      "activeKeyId": "first-signing-key",
      "keys" : {
              "first-signing-key" : {
                "signingKey" : "-----BEGIN RSA PRIVATE KEY-----\nMIIEogIBAAKCAQEA63iSAMPLEzUKpI8sB/AQdbZwwrDkSAMPLEt5xNM/wQrO\n5l/yWp3lCElSqnKSAMPLE8TcrkxuCyuxaV7B5ryq3w+g3R1x\n-----END RSA PRIVATE KEY-----\n"
              }
    },
    

    For more information, see UAA API documentation.

  4. Enable Multi-Factor Authentications (Beta)

    WARNING: Multi-factor authentication is a beta feature for PCF v2.2. Do not use multi-factor authentication in a production environment for PCF v2.2.

    You can enable multi-factor authentication (MFA) via Google Authenticator, available on the Apple Store or Android Play, for all users logging in to your service plan.

    1. Log in to your identity zone admin client you have already based upon the steps here.

    2. Create an MFA provider based on the UAA API documentation using the command below. The issuer value appears on users’ mobile Google Authenticator, so customize this value based on your needs.

      uaac curl -k '/mfa-providers' -X POST \
        -H 'Content-Type: application/json' \
        -H 'Accept: application/json' \
        -d '{
      "name" : "GoogleProvider",
      "config" : {
        "issuer" : "MFA Login for Company SSO Plan"
      },
      "type" : "google-authenticator"
      }'
      
    3. Using the steps in Update UAA Identity Zone Configurations with the API above to retrieve and update the current identity zone configurations for your SSO plan, update the mfaConfig section according to the UAA API documentation.

      An example of the section is below. Set the enable value to true and provide the MFA provider name.

      "mfaConfig" : {
        "enabled" : true,
        "providerName" : "GoogleProvider"
      }
      


      To disable MFA set enable to false.