Authenticate user
post
/oiri/api/v1/authenticate/{mode}
and return user information and JWT token.Additionally when mode is set to session then session ID is returned in a cookie named `JSESSIONID`.
Request
Path Parameters
-
mode: string
Mode type: * `session` - On successful user authentication return session ID in a cookie named JSESSIONID * `token` - On successful user authentication return JWT token
Supported Media Types
- application/json
Response
Supported Media Types
- application/json
200 Response
Successfully authenticated. If mode in request is session then session ID is returned in a cookie named `JSESSIONID`. You need to include this cookie in subsequent requests. If mode in request is set to token return Token.
Headers
400 Response
Bad request
401 Response
Unauthorized
Examples
The following example shows how to authenticate a user using cURL.
curl -X POST\ -H "Accept: application/json"\ -H "Content-Type: application/json" \ "http://localhost:port/oiri/api/v1/authenticate/session" -d
Example of the Request Body
The following is an example of the request body in JSON format.
{ username: "rfrost", password: "USER_PASSWORD" }
Example of the Response Body
The following is an example of the response body in JSON format.
{"authenticated": true, "user": { "userLogin": "RFROST", "name": "Robert Frost", "roles": ["OIRIRoleEngineer"], "email": "admin@example.com", "active": true }, "token": { "expiresIn": "1619012554000", "tokenType": "Bearer", "accessToken":"eyJraWQiOiJvaWkiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiO iJ3d3cub3JhY2xlLmNvbSIsImF1ZCI6Ind3dy5vcmFjbGUuY29tIiwiZXhwIjoxNjE5MDEyNTU0LCJqdGkiOiJsQWxZdGxWaUpRTVVTTWtVZWdNQTZ3IiwiaWF0IjoxNjE4OTk4MTU0LCJzdWIiOiJSb2JlcnQgRnJvc3QiLCJlbWFpbCI6ImFkbWluQG9yYWNsZS5jb20iLCJ1c2VyTG9naW4iOiJBRE1JTiIsInJvbGVzIjpbIk9yY2xPSVJJUm9sZUVuZ2luZWVyIl19.WwyaYNiB9SKo8PzJfdEDniGyKZzLV23kinp5Rg8LOwt409EHFRvVGDeHYFr0iV3Tp5I57i9G5cJ_yIi2A2fQ5nc4KbrVN-uVBni2fwrbm-88EsniZanr0OFZi98vBmnF-gbSxuuepwfesrRk78xvg-KEelfPZGzprg1T-_TcKxaj573iQgp1MRwVmCj5ElLwXIYutEVpcMBUorGKDe_ZbE5MNERAHzPqvEUs-WTbqhfLdbaJZ6t_WQ9JdEc-hfOJGo_ufbmM99w0UDC_Pd26H9DxivEOTBlXSlqfJPR1gNsWOIyu5EHiMdlCOPPF0knw8y_ISWsM_H4AlPMny16J8w"} }