github.com/axw/juju@v0.0.0-20161005053422-4bd6544d08d4/apiserver/params/registration.go (about)

     1  // Copyright 2016 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package params
     5  
     6  // SecretKeyLoginRequest contains the parameters for completing
     7  // the registration of a user. The request contains the tag of
     8  // the user, and an encrypted and authenticated payload that
     9  // proves that the requester has a secret key recorded on the
    10  // controller.
    11  type SecretKeyLoginRequest struct {
    12  	// User is the tag-representation of the user that the
    13  	// requester wishes to authenticate as.
    14  	User string `json:"user"`
    15  
    16  	// Nonce is the nonce used by the client to encrypt
    17  	// and authenticate PayloadCiphertext.
    18  	Nonce []byte `json:"nonce"`
    19  
    20  	// PayloadCiphertext is the encrypted and authenticated
    21  	// payload. The payload is encrypted/authenticated using
    22  	// NaCl Secretbox.
    23  	PayloadCiphertext []byte `json:"cipher-text"`
    24  }
    25  
    26  // SecretKeyLoginRequestPayload is JSON-encoded and then encrypted
    27  // and authenticated with the NaCl Secretbox algorithm.
    28  type SecretKeyLoginRequestPayload struct {
    29  	// Password is the new password to set for the user.
    30  	Password string `json:"password"`
    31  }
    32  
    33  // SecretKeyLoginResponse contains the result of completing a user
    34  // registration. This contains an encrypted and authenticated payload,
    35  // containing the information necessary to securely log into the
    36  // controller via the standard password authentication method.
    37  type SecretKeyLoginResponse struct {
    38  	// Nonce is the nonce used by the server to encrypt and
    39  	// authenticate PayloadCiphertext.
    40  	Nonce []byte `json:"nonce"`
    41  
    42  	// PayloadCiphertext is the encrypted and authenticated
    43  	// payload, which is a JSON-encoded SecretKeyLoginResponsePayload.
    44  	PayloadCiphertext []byte `json:"cipher-text"`
    45  }
    46  
    47  // SecretKeyLoginResponsePayload is JSON-encoded and then encrypted
    48  // and authenticated with the NaCl Secretbox algorithm.
    49  type SecretKeyLoginResponsePayload struct {
    50  	// CACert is the CA certificate, required to establish a secure
    51  	// TLS connection to the Juju controller
    52  	CACert string `json:"ca-cert"`
    53  
    54  	// ControllerUUID is the UUID of the Juju controller.
    55  	ControllerUUID string `json:"controller-uuid"`
    56  }