<!-- Code generated by gomarkdoc. DO NOT EDIT -->

```go
import "github.com/Azure/iot-operations-sdks/go/mqtt/auth"
```

## Index

- [Variables](<#variables>)
- [type AIOServiceAccountToken](<#AIOServiceAccountToken>)
  - [func NewAIOServiceAccountToken\(filename string\) \(\*AIOServiceAccountToken, error\)](<#NewAIOServiceAccountToken>)
  - [func \(sat \*AIOServiceAccountToken\) AuthSuccess\(requestReauth func\(\)\)](<#AIOServiceAccountToken.AuthSuccess>)
  - [func \(sat \*AIOServiceAccountToken\) Close\(\) error](<#AIOServiceAccountToken.Close>)
  - [func \(\*AIOServiceAccountToken\) ContinueAuth\(\*Values\) \(\*Values, error\)](<#AIOServiceAccountToken.ContinueAuth>)
  - [func \(sat \*AIOServiceAccountToken\) InitiateAuth\(bool\) \(\*Values, error\)](<#AIOServiceAccountToken.InitiateAuth>)
- [type Provider](<#Provider>)
- [type Values](<#Values>)


## Variables

<a name="ErrUnexpected"></a>

```go
var ErrUnexpected = errors.New("unexpected call to auth provider")
```

<a name="AIOServiceAccountToken"></a>
## type [AIOServiceAccountToken](<https://github.com/Azure/iot-operations-sdks/blob/main/go/mqtt/auth/mq_sat.go#L16-L23>)

AIOServiceAccountToken impelements an enhanced authentication provider that reads a Kubernetes Service Account Token for the AIO Broker.

```go
type AIOServiceAccountToken struct {
    // contains filtered or unexported fields
}
```

<a name="NewAIOServiceAccountToken"></a>
### func [NewAIOServiceAccountToken](<https://github.com/Azure/iot-operations-sdks/blob/main/go/mqtt/auth/mq_sat.go#L27-L29>)

```go
func NewAIOServiceAccountToken(filename string) (*AIOServiceAccountToken, error)
```

NewAIOServiceAccountToken creates a new AIO SAT auth provider from the given filename.

<a name="AIOServiceAccountToken.AuthSuccess"></a>
### func \(\*AIOServiceAccountToken\) [AuthSuccess](<https://github.com/Azure/iot-operations-sdks/blob/main/go/mqtt/auth/mq_sat.go#L64>)

```go
func (sat *AIOServiceAccountToken) AuthSuccess(requestReauth func())
```



<a name="AIOServiceAccountToken.Close"></a>
### func \(\*AIOServiceAccountToken\) [Close](<https://github.com/Azure/iot-operations-sdks/blob/main/go/mqtt/auth/mq_sat.go#L70>)

```go
func (sat *AIOServiceAccountToken) Close() error
```



<a name="AIOServiceAccountToken.ContinueAuth"></a>
### func \(\*AIOServiceAccountToken\) [ContinueAuth](<https://github.com/Azure/iot-operations-sdks/blob/main/go/mqtt/auth/mq_sat.go#L60>)

```go
func (*AIOServiceAccountToken) ContinueAuth(*Values) (*Values, error)
```



<a name="AIOServiceAccountToken.InitiateAuth"></a>
### func \(\*AIOServiceAccountToken\) [InitiateAuth](<https://github.com/Azure/iot-operations-sdks/blob/main/go/mqtt/auth/mq_sat.go#L56>)

```go
func (sat *AIOServiceAccountToken) InitiateAuth(bool) (*Values, error)
```



<a name="Provider"></a>
## type [Provider](<https://github.com/Azure/iot-operations-sdks/blob/main/go/mqtt/auth/types.go#L16-L48>)

Provider implements an MQTT enhanced authentication exchange. The provider may also implement io.Closer in order to clean up any resources when the client is shut down.

```go
type Provider interface {
    // InitiateAuth is called by the session client when an enhanced auth
    // exchange is initiated. An enhanced auth exchange is initiated when a new
    // MQTT connection is being created or when the Provider implementation
    // calls the requestReauth callback passed to it via AuthSuccess.
    //
    // `reauth` is true if this is a reauthentication on a live MQTT connection
    // and false it is on new MQTT connection.
    //
    // The return value is a pointer to a Values struct that contains values
    // that will be sent to the server via a CONNECT or AUTH packet.
    InitiateAuth(reauth bool) (*Values, error)

    // ContinueAuth is called by the session client when it receives an AUTH
    // packet from the server with reason code 0x18 (continue authentication).
    //
    // `values` contains the the values from the aforementioned AUTH packet.
    //
    // The return value is a pointer to to an Values struct that contains
    // values that will be sent to the server via an AUTH packet for this round
    // of the enhanced auth exchange.
    ContinueAuth(values *Values) (*Values, error)

    // AuthSuccess is called by the session client when it receives a CONNACK
    // or AUTH packet with a success reason code (0x00) after an enhanced auth
    // exchange was initiated.
    //
    // `requestReauth` is a callback that the Provider implementation may call
    // to tell the session client to initiate a reauthentication on the live
    // MQTT connection. Note that this function is valid for use for the entire
    // lifetime of the session client.
    AuthSuccess(requestReauth func())
}
```

<a name="Values"></a>
## type [Values](<https://github.com/Azure/iot-operations-sdks/blob/main/go/mqtt/auth/types.go#L8-L11>)

Values from AUTH packets sent to and received from the MQTT server.

```go
type Values struct {
    AuthMethod string
    AuthData   []byte
}
```

Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)
