[[undertow-spring-security-component]]
= Undertow Spring Security Security Provider
//by hand
:since: 3.3

*Since Camel {since}*

*OSGi is not supported*


The Spring Security Provider provides Spring Security (5.x) token bearer security over camel-undertow component.
To force camel-undertow to use spring security provider:

* Add spring security provider library on classpath.
* Provide instance of SpringSecurityConfiguration as `securityConfiguration`
parameter into camel-undertow component or provide both  `securityConfiguration` and `securityProvider`
into camel-undertow component.
* Configure spring-security.

Configuration has to provide following security attribute:
[width="100%"]
|===
| Name | Description | Type
| *securityFiler* | Provides security filter gained from configured spring security (5.x). Filter could be obtained
for example from DelegatingFilterProxyRegistrationBean. | Filter
|===

Each exchange created by Undertow endpoint with spring security contains header 'SpringSecurityProvider_principal' (
name of header is provided as a constant `SpringSecurityProvider.PRINCIPAL_NAME_HEADER`) with current authorized identity
as value  or header is not present in case of rejected requests.

// spring-boot-auto-configure options: START
=== Spring Boot Auto-Configuration


The component supports 6 options, which are listed below.



[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
| *camel.component.undertow.spring.security.enabled* | Enable undertow spring security component | true | Boolean
| *camel.component.undertow.spring.security.keycloak* | Properties defined for keycloak provider. Value is gathered together from properties with prefix "camel.component.undertow.spring.security.keycloak" |  | KeycloakProvider Configuration
| *camel.component.undertow.spring.security.keycloak.client-id* | Client id from the Keycloak server used for authentication. |  | String
| *camel.component.undertow.spring.security.keycloak.realm-id* | Realm id from the keycloak server used for authentication. |  | String
| *camel.component.undertow.spring.security.keycloak.url* | Url to keycloak server which will be used in spring security configuration. (Example "http://localhost:8080") |  | String
| *camel.component.undertow.spring.security.keycloak.user-name-attribute* | Name of the attribute, which will be used as username. | preffered_username | String
|===
// spring-boot-auto-configure options: END
