@@ -62,18 +62,93 @@ information on password encoders in Spring Security.
6262
6363### OpenID Connect
6464
65- hawkbit supports authentication providers which use the OpenID Connect standard, an authentication layer built on top of
66- the OAuth 2.0 protocol.
67- An example configuration is given below.
65+ HawkBit supports authentication providers which use the OpenID Connect standard, an authentication layer built on top of
66+ the OAuth 2.0 protocol. OIDC integration can be enabled on UI and in server:
67+
68+ - ** Hawkbit UI** — redirects users to an OIDC provider for authentication
69+ - ** Hawkbit Management Server** — validates JWT bearer tokens on Management API requests
70+
71+ #### Hawkbit UI
72+
73+ Enable OIDC login for the UI and register the provider using standard Spring Boot OAuth2 client properties:
74+
75+ ``` properties
76+ # Enable hawkBit OIDC UI login
77+ hawkbit.server.security.oauth2.client.enabled =true
78+
79+ # Register the provider (replace "myidp" with any name)
80+ spring.security.oauth2.client.provider.myidp.issuer-uri =https://idp.example.com/
81+ spring.security.oauth2.client.registration.myidp.client-id =my-client-id
82+ spring.security.oauth2.client.registration.myidp.client-secret =my-client-secret
83+ spring.security.oauth2.client.registration.myidp.scope =openid,email,profile
84+ spring.security.oauth2.client.registration.myidp.provider =myidp
85+ ```
86+
87+ Some providers (e.g. Auth0) require additional parameters in the authorization request. Use ` additional-query-string-params ` to pass
88+ them:
89+
90+ ``` properties
91+ # Add extra parameters to the OAuth2 authorization request
92+ hawkbit.server.security.oauth2.client.additional-query-string-params.audience =https://my-api-audience
93+ ```
94+
95+ Spring Security automatically sets the ` redirect_uri ` for the authorization code callback. It constructs the value as:
96+
97+ ```
98+ {baseUrl}/login/oauth2/code/myidp
99+ ```
100+
101+ This URL must be registered as an allowed redirect URI in your identity provider (IdP).
102+
103+ #### Hawkbit Management Server
104+
105+ Enable JWT bearer token validation for the Management REST API:
106+
107+ ``` properties
108+ # Enable hawkBit default JWT resource server
109+ hawkbit.server.security.oauth2.resourceserver.enabled =true
110+
111+ # JWK issuer URI for token signature verification
112+ spring.security.oauth2.resourceserver.jwt.issuer-uri =https://idp.example.com/
113+ ```
114+
115+ hawkBit maps JWT claims to the username, tenant, and permissions of the authenticated user. The claim paths are
116+ configurable and support dot-notation for nested claims (e.g. ` resource_access.my-client.roles ` ):
117+
118+ ``` properties
119+ # Claim path for the hawkBit username (default: preferred_username)
120+ hawkbit.server.security.oauth2.resourceserver.jwt.claim.username =preferred_username
121+
122+ # Claim path for hawkBit roles/permissions (default: roles)
123+ hawkbit.server.security.oauth2.resourceserver.jwt.claim.roles =roles
124+
125+ # Claim path for the hawkBit tenant (default: DEFAULT)
126+ hawkbit.server.security.oauth2.resourceserver.jwt.claim.tenant =tenant
127+ ```
128+
129+ To allow HTTP Basic authentication alongside OAuth2:
68130
69131``` properties
70- spring.security.oauth2.client.registration.oidc.client-id =clientID
71- spring.security.oauth2.client.provider.oidc.issuer-uri =https://oidc-provider/issuer-uri
72- spring.security.oauth2.client.provider.oidc.jwk-set-uri =https://oidc-provider/jwk-set-uri
132+ hawkbit.server.security.allow-http-basic-on-o-auth-enabled =true
73133```
74134
75- Note: at the moment only DEFAULT tenant is supported. By default the resource_access/<client id >/roles claim is mapped
76- to hawkBit permissions.
135+ #### Swagger UI
136+
137+ To enable OAuth2 authorization from Swagger UI, configure the authorization and token endpoints:
138+
139+ ``` properties
140+ springdoc.oauth-flow.authorizationUrl =https://idp.example.com/oauth2/authorize
141+ springdoc.oauth-flow.tokenUrl =https://idp.example.com/oauth2/token
142+ ```
143+
144+ Swagger UI automatically sets the ` redirect_uri ` when initiating the authorization flow. It constructs the value as:
145+
146+ ```
147+ {window.location.origin}{base-path}/swagger-ui/oauth2-redirect.html
148+ ```
149+
150+ This URL must be registered as an allowed redirect URI in your identity provider (IdP) configuration.
151+
77152
78153### Permissions
79154
0 commit comments