# EapSessionConfig.Builder

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Builder

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/net/eap/EapSessionConfig.Builder "View this page in Java")  

```
class Builder
```

|---|--------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                       ||
| ↳ | [android.net.eap.EapSessionConfig.Builder](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig.Builder#) |

This class can be used to incrementally construct an[EapSessionConfig](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig).

## Summary

|                                                                                                                               Public constructors                                                                                                                                ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig.Builder#Builder())`()` Constructs and returns a new Builder for constructing an[EapSessionConfig](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig). |

|                                                                                                                                                                                                                                                                                                                                                                             Public methods                                                                                                                                                                                                                                                                                                                                                                             ||
|----------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [EapSessionConfig](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig)                  | [build](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig.Builder#build())`()` Constructs and returns an EapSessionConfig with the configurations applied to this Builder.                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| [EapSessionConfig.Builder](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig.Builder#) | [setEapAkaConfig](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig.Builder#setEapAkaConfig(kotlin.Int,%20kotlin.Int))`(`subId:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `apptype:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets the configuration for EAP AKA.                                                                                                                                                                                                                                                                       |
| [EapSessionConfig.Builder](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig.Builder#) | [setEapAkaConfig](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig.Builder#setEapAkaConfig(kotlin.Int,%20kotlin.Int,%20android.net.eap.EapSessionConfig.EapAkaOption))`(`subId:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `apptype:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `options:` `[EapSessionConfig.EapAkaOption](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig.EapAkaOption)`)` Sets the configuration for EAP AKA with options.                                                             |
| [EapSessionConfig.Builder](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig.Builder#) | [setEapAkaPrimeConfig](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig.Builder#setEapAkaPrimeConfig(kotlin.Int,%20kotlin.Int,%20kotlin.String,%20kotlin.Boolean))`(`subId:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `apptype:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `networkName:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `allowMismatchedNetworkNames:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Sets the configuration for EAP AKA'. |
| [EapSessionConfig.Builder](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig.Builder#) | [setEapIdentity](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig.Builder#setEapIdentity(kotlin.ByteArray))`(`eapIdentity:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)`)` Sets the client's EAP Identity.                                                                                                                                                                                                                                                                                                                                                           |
| [EapSessionConfig.Builder](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig.Builder#) | [setEapMsChapV2Config](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig.Builder#setEapMsChapV2Config(kotlin.String,%20kotlin.String))`(`username:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `password:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Sets the configuration for EAP MSCHAPv2.                                                                                                                                                                                                                                  |
| [EapSessionConfig.Builder](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig.Builder#) | [setEapSimConfig](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig.Builder#setEapSimConfig(kotlin.Int,%20kotlin.Int))`(`subId:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `apptype:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets the configuration for EAP SIM.                                                                                                                                                                                                                                                                       |
| [EapSessionConfig.Builder](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig.Builder#) | [setEapTtlsConfig](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig.Builder#setEapTtlsConfig(java.security.cert.X509Certificate,%20android.net.eap.EapSessionConfig))`(`serverCaCert:` `[X509Certificate](https://developer.android.com/reference/kotlin/java/security/cert/X509Certificate.html#)?`, `innerEapSessionConfig:` `[EapSessionConfig](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig)`)` Sets the configuration for EAP-TTLS.                                                                                                                                       |

## Public constructors

### Builder

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Builder()
```

Constructs and returns a new Builder for constructing an[EapSessionConfig](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig).

## Public methods

### build

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun build(): EapSessionConfig
```

Constructs and returns an EapSessionConfig with the configurations applied to this Builder.

|                                                                                       Return                                                                                       ||
|-----------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------|
| [EapSessionConfig](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig) | the EapSessionConfig constructed by this Builder. This value cannot be`null`. |

### setEapAkaConfig

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setEapAkaConfig(
    subId: Int, 
    apptype: Int
): EapSessionConfig.Builder
```

Sets the configuration for EAP AKA.

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ||
|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `subId`   | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):int the client's subId to be authenticated.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `apptype` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the apptype to be used for authentication. Value is[android.telephony.TelephonyManager#APPTYPE_SIM](https://developer.android.com/reference/kotlin/android/telephony/TelephonyManager.html#APPTYPE_SIM:kotlin.Int),[android.telephony.TelephonyManager#APPTYPE_USIM](https://developer.android.com/reference/kotlin/android/telephony/TelephonyManager.html#APPTYPE_USIM:kotlin.Int),[android.telephony.TelephonyManager#APPTYPE_RUIM](https://developer.android.com/reference/kotlin/android/telephony/TelephonyManager.html#APPTYPE_RUIM:kotlin.Int),[android.telephony.TelephonyManager#APPTYPE_CSIM](https://developer.android.com/reference/kotlin/android/telephony/TelephonyManager.html#APPTYPE_CSIM:kotlin.Int), or[android.telephony.TelephonyManager#APPTYPE_ISIM](https://developer.android.com/reference/kotlin/android/telephony/TelephonyManager.html#APPTYPE_ISIM:kotlin.Int) |

|                                                                                         Return                                                                                          ||
|----------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------|
| [EapSessionConfig.Builder](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig.Builder#) | Builder this, to facilitate chaining. This value cannot be`null`. |

### setEapAkaConfig

Added in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setEapAkaConfig(
    subId: Int, 
    apptype: Int, 
    options: EapSessionConfig.EapAkaOption
): EapSessionConfig.Builder
```

Sets the configuration for EAP AKA with options.

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ||
|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `subId`   | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):int the client's subId to be authenticated.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `apptype` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the apptype to be used for authentication. Value is[android.telephony.TelephonyManager#APPTYPE_SIM](https://developer.android.com/reference/kotlin/android/telephony/TelephonyManager.html#APPTYPE_SIM:kotlin.Int),[android.telephony.TelephonyManager#APPTYPE_USIM](https://developer.android.com/reference/kotlin/android/telephony/TelephonyManager.html#APPTYPE_USIM:kotlin.Int),[android.telephony.TelephonyManager#APPTYPE_RUIM](https://developer.android.com/reference/kotlin/android/telephony/TelephonyManager.html#APPTYPE_RUIM:kotlin.Int),[android.telephony.TelephonyManager#APPTYPE_CSIM](https://developer.android.com/reference/kotlin/android/telephony/TelephonyManager.html#APPTYPE_CSIM:kotlin.Int), or[android.telephony.TelephonyManager#APPTYPE_ISIM](https://developer.android.com/reference/kotlin/android/telephony/TelephonyManager.html#APPTYPE_ISIM:kotlin.Int) |
| `options` | [EapSessionConfig.EapAkaOption](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig.EapAkaOption):optional configuration for EAP AKA This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |

|                                                                                         Return                                                                                          ||
|----------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------|
| [EapSessionConfig.Builder](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig.Builder#) | Builder this, to facilitate chaining. This value cannot be`null`. |

### setEapAkaPrimeConfig

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setEapAkaPrimeConfig(
    subId: Int, 
    apptype: Int, 
    networkName: String, 
    allowMismatchedNetworkNames: Boolean
): EapSessionConfig.Builder
```

Sets the configuration for EAP AKA'.

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ||
|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `subId`                       | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):int the client's subId to be authenticated.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `apptype`                     | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the apptype to be used for authentication. Value is[android.telephony.TelephonyManager#APPTYPE_SIM](https://developer.android.com/reference/kotlin/android/telephony/TelephonyManager.html#APPTYPE_SIM:kotlin.Int),[android.telephony.TelephonyManager#APPTYPE_USIM](https://developer.android.com/reference/kotlin/android/telephony/TelephonyManager.html#APPTYPE_USIM:kotlin.Int),[android.telephony.TelephonyManager#APPTYPE_RUIM](https://developer.android.com/reference/kotlin/android/telephony/TelephonyManager.html#APPTYPE_RUIM:kotlin.Int),[android.telephony.TelephonyManager#APPTYPE_CSIM](https://developer.android.com/reference/kotlin/android/telephony/TelephonyManager.html#APPTYPE_CSIM:kotlin.Int), or[android.telephony.TelephonyManager#APPTYPE_ISIM](https://developer.android.com/reference/kotlin/android/telephony/TelephonyManager.html#APPTYPE_ISIM:kotlin.Int) |
| `networkName`                 | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):String the network name to be used for authentication. This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `allowMismatchedNetworkNames` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html):indicates whether the EAP library can ignore potential mismatches between the given network name and that received in an EAP-AKA' session. If false, mismatched network names will be handled as an Authentication Reject message.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |

|                                                                                         Return                                                                                          ||
|----------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------|
| [EapSessionConfig.Builder](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig.Builder#) | Builder this, to facilitate chaining. This value cannot be`null`. |

### setEapIdentity

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setEapIdentity(eapIdentity: ByteArray): EapSessionConfig.Builder
```

Sets the client's EAP Identity.

|                                                                                     Parameters                                                                                      ||
|---------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `eapIdentity` | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html):byte\[\] representing the client's EAP Identity. This value cannot be`null`. |

|                                                                                         Return                                                                                          ||
|----------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------|
| [EapSessionConfig.Builder](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig.Builder#) | Builder this, to facilitate chaining. This value cannot be`null`. |

### setEapMsChapV2Config

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setEapMsChapV2Config(
    username: String, 
    password: String
): EapSessionConfig.Builder
```

Sets the configuration for EAP MSCHAPv2.

|                                                                                     Parameters                                                                                     ||
|------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `username` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):String the client account's username to be authenticated. This value cannot be`null`. |
| `password` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):String the client account's password to be authenticated. This value cannot be`null`. |

|                                                                                         Return                                                                                         ||
|----------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------|
| [EapSessionConfig.Builder](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig.Builder#) | Builder this, to faciliate chaining. This value cannot be`null`. |

### setEapSimConfig

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setEapSimConfig(
    subId: Int, 
    apptype: Int
): EapSessionConfig.Builder
```

Sets the configuration for EAP SIM.

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ||
|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `subId`   | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):int the client's subId to be authenticated.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `apptype` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the apptype to be used for authentication. Value is[android.telephony.TelephonyManager#APPTYPE_SIM](https://developer.android.com/reference/kotlin/android/telephony/TelephonyManager.html#APPTYPE_SIM:kotlin.Int),[android.telephony.TelephonyManager#APPTYPE_USIM](https://developer.android.com/reference/kotlin/android/telephony/TelephonyManager.html#APPTYPE_USIM:kotlin.Int),[android.telephony.TelephonyManager#APPTYPE_RUIM](https://developer.android.com/reference/kotlin/android/telephony/TelephonyManager.html#APPTYPE_RUIM:kotlin.Int),[android.telephony.TelephonyManager#APPTYPE_CSIM](https://developer.android.com/reference/kotlin/android/telephony/TelephonyManager.html#APPTYPE_CSIM:kotlin.Int), or[android.telephony.TelephonyManager#APPTYPE_ISIM](https://developer.android.com/reference/kotlin/android/telephony/TelephonyManager.html#APPTYPE_ISIM:kotlin.Int) |

|                                                                                         Return                                                                                          ||
|----------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------|
| [EapSessionConfig.Builder](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig.Builder#) | Builder this, to facilitate chaining. This value cannot be`null`. |

### setEapTtlsConfig

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setEapTtlsConfig(
    serverCaCert: X509Certificate?, 
    innerEapSessionConfig: EapSessionConfig
): EapSessionConfig.Builder
```

Sets the configuration for EAP-TTLS.

Tunneled EAP-TTLS authentications are disallowed, as running multiple layers of EAP-TTLS increases the data footprint but has no discernible benefits over a single EAP-TTLS session with a non EAP-TTLS method nested inside it.

|                                                                                                                                                                                                                Parameters                                                                                                                                                                                                                 ||
|-------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `serverCaCert`          | [X509Certificate](https://developer.android.com/reference/kotlin/java/security/cert/X509Certificate.html#)?:the CA certificate for validating the received server certificate(s). If a certificate is provided, it MUST be the root CA used by the server, or authentication will fail. If no certificate is provided, any root CA in the system's truststore is considered acceptable. This value may be`null`. |
| `innerEapSessionConfig` | [EapSessionConfig](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig):represents the configuration for the inner EAP instance This value cannot be`null`.                                                                                                                                                                                                                          |

|                                                                                         Return                                                                                         ||
|----------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------|
| [EapSessionConfig.Builder](https://developer.android.com/reference/kotlin/android/net/eap/EapSessionConfig.Builder#) | Builder this, to facilitate chaining This value cannot be`null`. |