Package org.apache.qpid.proton.engine

# Interface Sasl

All Known Implementing Classes:
  `SaslImpl`

public interface Sasl

## Nested Class Summary

Nested Classes
Modifier and Type
Interface
Description
`static enum`
`Sasl.SaslOutcome`
`static enum`
`Sasl.SaslState`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final Sasl.SaslOutcome`
`PN_SASL_AUTH`
`static final Sasl.SaslOutcome`
`PN_SASL_NONE`
`static final Sasl.SaslOutcome`
`PN_SASL_OK`
`static final Sasl.SaslOutcome`
`PN_SASL_PERM`
`static final Sasl.SaslOutcome`
`PN_SASL_SKIPPED`
`static final Sasl.SaslOutcome`
`PN_SASL_SYS`
`static final Sasl.SaslOutcome`
`PN_SASL_TEMP`

## Method Summary

Modifier and Type
Method
Description
`void`
`allowSkip(boolean allowSkip)`
Set whether servers may accept incoming connections that skip the SASL layer negotiation.
`void`
`client()`
`void`
`done(Sasl.SaslOutcome outcome)`
Set the outcome of SASL negotiation Used by the server to set the result of the negotiation process.
`String`
`getHostname()`
Retrieve the hostname indicated by the client when sending its SaslInit.
`Sasl.SaslOutcome`
`getOutcome()`
Retrieve the outcome of SASL negotiation.
`String[]`
`getRemoteMechanisms()`
Retrieve the list of SASL mechanisms provided by the remote.
`Sasl.SaslState`
`getState()`
Access the current state of the layer.
`int`
`pending()`
Determine the size of the bytes available via recv().
`void`
`plain(String username, String password)`
Configure the SASL layer to use the "PLAIN" mechanism.
`int`
`recv(byte[] bytes, int offset, int size)`
Read challenge/response/additional data sent from the peer.
`int`
`send(byte[] bytes, int offset, int size)`
Send challenge/response/additional data to the peer.
`void`
`server()`
`void`
`setListener(SaslListener saslListener)`
Adds a listener to receive notice of frames having arrived.
`void`
`setMechanisms(String... mechanisms)`
Set the acceptable SASL mechanisms for the layer.
`void`
`setRemoteHostname(String hostname)`
Set the remote hostname to indicate the host being connected to when sending a SaslInit to the server.

## Field Details

### PN_SASL_NONE

static final Sasl.SaslOutcome PN_SASL_NONE

### PN_SASL_OK

static final Sasl.SaslOutcome PN_SASL_OK

### PN_SASL_AUTH

static final Sasl.SaslOutcome PN_SASL_AUTH

### PN_SASL_SYS

static final Sasl.SaslOutcome PN_SASL_SYS

### PN_SASL_PERM

static final Sasl.SaslOutcome PN_SASL_PERM

### PN_SASL_TEMP

static final Sasl.SaslOutcome PN_SASL_TEMP

### PN_SASL_SKIPPED

static final Sasl.SaslOutcome PN_SASL_SKIPPED

## Method Details

### getState

Sasl.SaslState getState()
Access the current state of the layer.

Returns:
  The state of the sasl layer.

### setMechanisms

void setMechanisms(String... mechanisms)
Set the acceptable SASL mechanisms for the layer.

Parameters:
  `mechanisms` - a list of acceptable SASL mechanisms

### getRemoteMechanisms

String[] getRemoteMechanisms()
Retrieve the list of SASL mechanisms provided by the remote.

Returns:
  the SASL mechanisms advertised by the remote

### setRemoteHostname

void setRemoteHostname(String hostname)
Set the remote hostname to indicate the host being connected to when sending a SaslInit to the server.

### getHostname

String getHostname()
Retrieve the hostname indicated by the client when sending its SaslInit.

Returns:
  the hostname indicated by the remote client, or null if none specified.

### pending

int pending()
Determine the size of the bytes available via recv(). Returns the size in bytes available via recv().

Returns:
  The number of bytes available, zero if no available data.

### recv

int recv(byte[] bytes, int offset, int size)
Read challenge/response/additional data sent from the peer. Use pending to determine the size of the data.

Parameters:
  `bytes` - written with up to size bytes of inbound data.
  `offset` - the offset in the array to begin writing at
  `size` - maximum number of bytes that bytes can accept.
Returns:
  The number of bytes written to bytes, or an error code if < 0.

### send

int send(byte[] bytes, int offset, int size)
Send challenge/response/additional data to the peer.

Parameters:
  `bytes` - The challenge/response data.
  `offset` - the point within the array at which the data starts at
  `size` - The number of data octets in bytes.
Returns:
  The number of octets read from bytes, or an error code if < 0

### done

void done(Sasl.SaslOutcome outcome)
Set the outcome of SASL negotiation Used by the server to set the result of the negotiation process.

Parameters:
  `outcome` - the outcome of the SASL negotiation

### plain

void plain(String username, String password)
Configure the SASL layer to use the "PLAIN" mechanism. A utility function to configure a simple client SASL layer using PLAIN authentication.

Parameters:
  `username` - credential for the PLAIN authentication mechanism
  `password` - credential for the PLAIN authentication mechanism

### getOutcome

Sasl.SaslOutcome getOutcome()
Retrieve the outcome of SASL negotiation.

### client

void client()

### server

void server()

### allowSkip

void allowSkip(boolean allowSkip)
Set whether servers may accept incoming connections that skip the SASL layer negotiation.

### setListener

void setListener(SaslListener saslListener)
Adds a listener to receive notice of frames having arrived.