github.com/Jeffail/benthos/v3@v3.65.0/internal/impl/nats/auth/docs.go (about)

     1  package auth
     2  
     3  import "github.com/Jeffail/benthos/v3/internal/docs"
     4  
     5  // Description returns a markdown version of NATs authentication documentation.
     6  func Description() string {
     7  	return `### Authentication
     8  
     9  There are several components within Benthos which utilise NATS services. You will find that each of these components
    10  support optional advanced authentication parameters for [NKeys](https://docs.nats.io/nats-server/configuration/securing_nats/auth_intro/nkey_auth)
    11  and [User Credentials](https://docs.nats.io/developing-with-nats/security/creds).
    12  
    13  An in depth tutorial can be found [here](https://docs.nats.io/developing-with-nats/tutorials/jwt).
    14  
    15  #### NKey file
    16  
    17  The NATS server can use these NKeys in several ways for authentication. The simplest is for the server to be configured
    18  with a list of known public keys and for the clients to respond to the challenge by signing it with its private NKey
    19  configured in the ` + "`nkey_file`" + ` field.
    20  
    21  More details [here](https://docs.nats.io/developing-with-nats/security/nkey).
    22  
    23  #### User Credentials file
    24  
    25  NATS server supports decentralized authentication based on JSON Web Tokens (JWT). Clients need an [user JWT](https://docs.nats.io/nats-server/configuration/securing_nats/jwt#json-web-tokens)
    26  and a corresponding [NKey secret](https://docs.nats.io/developing-with-nats/security/nkey) when connecting to a server
    27  which is configured to use this authentication scheme.
    28  
    29  The ` + "`user_credentials_file`" + ` field should point to a file containing both the private key and the JWT and can be
    30  generated with the [nsc tool](https://docs.nats.io/nats-tools/nsc).
    31  
    32  More details [here](https://docs.nats.io/developing-with-nats/security/creds).`
    33  }
    34  
    35  // FieldSpec returns documentation authentication specs for NATS components
    36  func FieldSpec() docs.FieldSpec {
    37  	return docs.FieldObject("auth", "Optional configuration of NATS authentication parameters.").WithChildren(
    38  		docs.FieldString("nkey_file", "An optional file containing a NKey seed.", "./seed.nk").Optional(),
    39  		docs.FieldString("user_credentials_file", "An optional file containing user credentials which consist of an user JWT and corresponding NKey seed.", "./user.creds").Optional(),
    40  	).Advanced()
    41  }