io.undertow.security.impl

## Class ExternalAuthenticationMechanism

- java.lang.Object
- - io.undertow.security.impl.ExternalAuthenticationMechanism

All Implemented Interfaces:
  AuthenticationMechanism

    public class ExternalAuthenticationMechanism
    extends Object
    implements AuthenticationMechanism

Authentication mechanism that uses an externally provided principal. WARNING: This method performs no verification. It must only be used if there is no way for an end user to modify the principal, for example if Undertow is behind a front end server that is responsible for authentication.

Author:
  Stuart Douglas

### Nested Class Summary

Nested Classes
`static class` `ExternalAuthenticationMechanism.Factory`

### Nested classes/interfaces inherited from interface io.undertow.security.api.AuthenticationMechanism

`AuthenticationMechanism.AuthenticationMechanismOutcome, AuthenticationMechanism.ChallengeResult`

### Field Summary

Fields
`static AttachmentKey<String>` `EXTERNAL_AUTHENTICATION_TYPE`
`static AttachmentKey<String>` `EXTERNAL_PRINCIPAL`
`static AuthenticationMechanismFactory` `FACTORY`
`static String` `NAME`

### Constructor Summary

Constructors
Constructor and Description
`ExternalAuthenticationMechanism()`
`ExternalAuthenticationMechanism(String name)`
`ExternalAuthenticationMechanism(String name, IdentityManager identityManager)`

### Method Summary

All Methods Instance Methods Concrete Methods
`AuthenticationMechanism.AuthenticationMechanismOutcome` `authenticate(HttpServerExchange exchange, SecurityContext securityContext)` Perform authentication of the request.
`AuthenticationMechanism.ChallengeResult` `sendChallenge(HttpServerExchange exchange, SecurityContext securityContext)` Send an authentication challenge to the remote client.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### FACTORY

    public static final AuthenticationMechanismFactory FACTORY

#### NAME

    public static final String NAME

See Also:
  Constant Field Values

#### EXTERNAL_PRINCIPAL

    public static final AttachmentKey<String> EXTERNAL_PRINCIPAL

#### EXTERNAL_AUTHENTICATION_TYPE

    public static final AttachmentKey<String> EXTERNAL_AUTHENTICATION_TYPE

### Constructor Detail

#### ExternalAuthenticationMechanism

    public ExternalAuthenticationMechanism(String name,
                                           IdentityManager identityManager)

#### ExternalAuthenticationMechanism

    public ExternalAuthenticationMechanism(String name)

#### ExternalAuthenticationMechanism

    public ExternalAuthenticationMechanism()

### Method Detail

#### authenticate

    public AuthenticationMechanism.AuthenticationMechanismOutcome authenticate(HttpServerExchange exchange,
                                                                               SecurityContext securityContext)

Description copied from interface: `AuthenticationMechanism`
Perform authentication of the request. Any potentially blocking work should be performed in the handoff executor provided

Specified by:
  `authenticate` in interface `AuthenticationMechanism`
Parameters:
  `exchange` - The exchange
Returns:

#### sendChallenge

    public AuthenticationMechanism.ChallengeResult sendChallenge(HttpServerExchange exchange,
                                                                 SecurityContext securityContext)

Description copied from interface: `AuthenticationMechanism`
Send an authentication challenge to the remote client.

The individual mechanisms should update the response headers and body of the message as appropriate however they should not set the response code, instead that should be indicated in the `AuthenticationMechanism.ChallengeResult` and the most appropriate overall response code will be selected. This method should not return `null`.

Specified by:
  `sendChallenge` in interface `AuthenticationMechanism`
Parameters:
  `exchange` - The exchange
  `securityContext` - The security context
Returns:
  A `AuthenticationMechanism.ChallengeResult` indicating if a challenge was sent and the desired response code.