Class AzurePostgresqlAuthenticationPlugin

java.lang.Object
com.azure.identity.extensions.jdbc.postgresql.AzurePostgresqlAuthenticationPlugin
All Implemented Interfaces:
org.postgresql.plugin.AuthenticationPlugin

public class AzurePostgresqlAuthenticationPlugin extends Object implements org.postgresql.plugin.AuthenticationPlugin
The authentication plugin that enables authentication with Microsoft Entra ID.
  • Constructor Details

    • AzurePostgresqlAuthenticationPlugin

      public AzurePostgresqlAuthenticationPlugin(Properties properties)
      Constructor with properties.
      Parameters:
      properties - the properties.
  • Method Details

    • getPassword

      public char[] getPassword(org.postgresql.plugin.AuthenticationRequestType type) throws org.postgresql.util.PSQLException
      Callback method to provide the password to use for authentication.
      Specified by:
      getPassword in interface org.postgresql.plugin.AuthenticationPlugin
      Parameters:
      type - The authentication method that the server is requesting.

      AzurePostgresqlAuthenticationPlugin is used as an extension to perform authentication with Microsoft Entra ID, the value here is CLEARTEXT_PASSWORD.

      When PostgreSQL client trying to connect with PostgreSQL server: 1. Client will send startup packet to server, the server will return the AuthenticationRequestType it accepts, If the username is used to perform Microsoft Entra authentication, the server will return CLEARTEXT_PASSWORD. 2. Client will do authentication (until AuthenticationOk).
      Returns:
      The password to use.
      Throws:
      org.postgresql.util.PSQLException - It will return a PSQLException if the password is null.