OpenID Connect

From TMM Wiki
Jump to navigationJump to search
NATS 4
Members Admin
The Members Admin
View Member Details
Add Member
MySQL Auth
Mod Authn DB
Multisite Access
Member Logging
Member Password Retrieval
OpenID Connect
Mod Auth OpenIDC
ID Numbers

As of version 4.1.21.1 NATS can be used as an OpenID Connect server. This is another option for member authentication. In order to utilize this feature, you will need to use an OpenID Connect client. When developing this feature, we used the mod_auth_openidc apache module. Here is an example implementation. Unlike the standard OpenID Connect server implemantaion, consent for the surfer to provide protected details (like username and email) to the client (members area) is implied.

Setup

  • Go to the NATS config admin -> surfers and scroll down to the 'Member OpenID Connect Server' section
  • Enable the ENABLE_MEMBER_OPENID config option
  • Provide a list of all ips defined on your member area server(s) by entering it into the MEMBER_OPENID_SECURE_IPS field
  • Enter the password that your member area(s) is(are) going to use for the token endpoint authentication into the MEMBER_OPENID_CLIENT_SECRET field
  • Decide what domain (and protocol) you will use for the authorization (login) page as well as the token and the userinfo endpoints
  • Determine what claims you want returned
  • Setup an OpenID Connect client in your members area(s)

Additional Configuration Options

  • MEMBER_OPENID_EXPIRED_LOGIN - enabling this option will allow expired members to login. You will be able to differentiate active members from expired members by using the [claim]. It will have value 1 for active members and 2 for expired members.
  • MEMBER_OPENID_DESCRIPTIVE_LOGIN_ERROR - enabling this option will display a descriptive error message on the login page when the authentication fails. Some of the example error messages include 'Incorrect username!' and 'Incorrect password!'. If this option is disabled, regardless of the reason for failed authentication, members will receive the 'Login Failed!' error message. This option helps with debugging. But for security reasons, we recommend disabling this option in production environments.
  • MEMBER_OPENID_SETUP_ERROR_SHOW_TEMPLATE - enabling this option will display a NATS site template when a configuration error occurs instead of redirecting back to the members area. One example of the configuration error is not enabling the ENABLE_MEMBER_OPENID option.
  • MEMBER_OPENID_AUTH_CODE_DURATION - this option determines the length of time (in seconds) that the auth code (from the authorization endpoint aka the login page) is good for.
  • MEMBER_OPENID_ACCESS_TOKEN_DURATION - this option determines the length of time (in seconds) that the access token (from the token endpoint) is good for.
  • MEMBER_OPENID_SIGN_USERINFO_REPLY - enabling this option will cause NATS OpenID Connect server to sign the userinfo endpoint reply (in the same way that id_token is signed in the token endpoint reply) and return a JSON Web Token instead of a JSON encoded array

Authorization Domain

You have a couple options when deciding what domain (and protocol) will be used for the authorization (login) page as well as the token and the userinfo endpoints.

  1. You can use the main NATS url. In this case, the value of the PROJECT_HOSTNAME config setting will be used for the domain and the protocol will be determined by the PROJECT_HOSTNAME_DISPLAY_HTTPS config setting.
  2. You can provide a single domain (and protocol) to use via the MEMBER_OPENID_DOMAIN config setting. This is very similar to the option above, except that it will be different than the main NATS domain.
  3. You can use each site's link domain. To do this, you will need to enabled the MEMBER_OPENID_DYNAMIC_DOMAIN config option.
  4. You can make a custom authorization domain for each site. This is very similar to the option above, except that it will be different than the domain of the join page (login.yoursite.com instead of join.yoursite.com). You will need to setup each of these domains in a similar way that you setup your link domains.

Claims

The id_token that is generated by the token endpoint contains only the sub claim. The value is the NATS member id for the successfully authenticated member. The userinfo endpoint contains a variety of other claims. NATS OpenID Connect server will return all claims that you enabled. Here is the breakdown of claims that the NATS OpenID Connect server can return.

  • Default
    • sub (NATS memberid)
    • username
  • if you enabled the MEMBER_OPENID_BASE_INFO configuration option, you will also get:
    • email
    • firstname
    • lastname
    • trial (1 if in trial, 0 otherwise)
    • status (1 if active, 2 if expired)
    • siteid
  • if you enable the MEMBER_OPENID_JOIN_EXPIRE_INFO configuration option, you will also get a json encoded array named join_expire with the following fields (all UNIX timestamps):
    • joined
    • expired
    • expires
    • nats_expires
    • biller_expires
  • if you enable the MEMBER_OPENID_IDENTIFIER_INFO configuration option, you will also get a json encoded array named identifier with the following fields:
    • identid (internal NATS identifier id)
    • loginid (id of the affiliate)
    • campaignid
    • programid
    • optoinid
    • siteid
    • tourid
    • countryid
    • adtoolid
    • billerid
    • subid1
    • subid2
    • promotionalid
  • if you enable the MEMBER_OPENID_ADDRESS_INFO configuration option, you will also get a json encoded array named address with the following fields:
    • address1
    • address2
    • city
    • state
    • zip
    • country
  • if you enable the MEMBER_OPENID_CUSTOM_INFO configuration option, you will also get a json encoded array named customs with the custom1..10 fields
  • if you enable the MEMBER_OPENID_PASSTHROUGH_INFO configuration option, you will also get a json encoded array named passthroughs with the passthroughs1..5 fields (affiliate passthroughs)

Additional Resources

TMM wiki on mod_auth_openidc