Setup Google Authentication
Setting up Google authentication using the Shiro cartridge requires you to configure tribefire and Google credentials.
General
Using the Shiro cartridge allows you to integrate and use a third-party authentication service like Google to login to tribefire or applications built on tribefire. This enables you to use a third-party account to successfully create and maintain a tribefire session.
You will configure two endpoints in this procedure: tribefire and Google credentials.
For Google Cloud documentation, see https://cloud.google.com/docs/
Initial Setup
In this procedure, we assume you already have a running local instance of tribefire. We will integrate a Google login to your local instance.
For information on how to install tribefire, see Quick Installation.
- Download the Shiro cartridge.
See Resources for information where to download tribefire components from.
- Open Control Center and synchronize the cartridge with your tribefire instance.
For more information, see Using Control Center
- In Control Center, navigate to Cartridges -> Show All and expand the shiro.cartridge entry.
- Expand the roles property and add the
tf-admin
property to the list. - Commit your changes and synchronize your cartridge again.
Google Authentication Setup
- Login to
https://console.developers.google.com
and create a new project if you don't have one already. - Add new OAuth credentials to your project. Take a note of the
clientID
andsecret
as you will need them later. - Click you new project's client ID and inspect the Restrictions section.
- In the Authorized JavaScript origins section, add
http://localhost:8080
. - In the Authorized redirect URIs section, add
http://localhost:8080/tribefire-services/component/remote-login/auth/callback?client_name=Google
. - Save your changes.
If your tribefire (or application built on tribefire) is not running on your local machine, make sure to change the
localhost:8080
part of the URLs.
Remote Terminal Configuration
- In Control Center, navigate to Apps and expand the Remote Login Terminal entry.
- Mark the createUsers checkbox.
- Depending on what you want to achieve, add items to userWhitelist or userBlacklist. For example, if you want to add all users who have
braintribe.com
in their Google login, you can use the following RegEx:^[a-zA-Z0-9_.+-]+@(?:(?:[a-zA-Z0-9-]+\.)?[a-zA-Z]+\.)?(braintribe)\.com$)
. - Expand the configuration extry and set the value of the
unauthenticatedUrl
property. When user authentication fails, this is the URL the user is redirected to.
User authentication is considered failed if you provide the wrong credentials or close the authentication popup.
- If the
callbackUrl
andunauthorizedUrl
properties are empty, set them tohttps://host:port/tribefire-services/component/remote-login/auth/callback
andhttps://host:port/tribefire-services/component/remote-login
respectively. - Still in configuration, expand the
clients
entry and clickShiroOidcGoogleClient
. - Set the values of
clientId
andsecret
to the same values as in the Google console and commit your changes. - Navigate to Custom Deployables and deploy the authentication components in the following order:
Shiro Service Processor
Fixed Roles for New Users Provider
Remote Login Terminal
Shiro Bootstrapping Worker
- In your browser, navigate to
http://localhost:8080/tribefire-services/component/remote-login
and select the Google link. This displays a Google authentication screen where you can log in using your Google credentials.
Note that you can still log in to tribefire without using Google.