How to add JSESSIONID cookie?
See original GitHub issuespringfox 2.6.1
I used ApiKey but not found cookie configuration.
@Configuration
@EnableSwagger2
public class ApiSwaggerConfig {
@Autowired
private Environment environment;
@Bean
public Docket api() {
Set<String> protocols = new HashSet<>();
protocols.add(environment.getProperty("swagger.protocol"));
Set<String> producesList = new HashSet<>();
producesList.add("application/json");
return new Docket(DocumentationType.SWAGGER_2)
.select()
// .apis(RequestHandlerSelectors.basePackage("com.jakduk.restcontroller"))
.paths(PathSelectors.ant("/api/**"))
.build()
.protocols(protocols)
.host(environment.getProperty("swagger.host"))
.apiInfo(apiInfo())
.useDefaultResponseMessages(false)
.securitySchemes(Collections.singletonList(apiKey()))
.produces(producesList);
}
@Bean
SecurityConfiguration security() {
return new SecurityConfiguration(
"test-app-client-id",
"test-app-client-secret",
"test-app-realm",
"test-app",
"",
ApiKeyVehicle.HEADER,
"api_key",
"," /*scope separator*/);
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("JakduK REST API with Swagger")
.contact(new Contact("pio.", "https://jakduk.com", "phjang1983@daum.net"))
.license("The MIT License (MIT)")
.licenseUrl("https://github.com/JakduK/jakduk-api/blob/master/LICENSE")
.build();
}
private ApiKey apiKey() {
return new ApiKey("JSESSIONID", "api_key", "cookie");
}
}
I want add cookie value.
curl -X GET --header 'Accept: application/json' -H "Cookie: JSESSIONID=136B750B08DA826CE5EA28261E47E135" 'http://localhost:8080/api/auth/user/attempt'
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:17 (4 by maintainers)
Top Results From Across the Web
java - setting Cookie: JSESSIONID on client request manually
problem is when the httpRequest gets to the server the "Cookie: JSESSIONID" header is there, session id is there; but the request.getSession( ...
Read more >Setting the Secure and HTTPOnly flags on the JSESSIONID ...
To set the Secure flag on the JSESSIONID cookie: Go to the Session management panel below and make sure the option "Restrict cookies...
Read more >Using HTTP cookies - MDN Web Docs
After receiving an HTTP request, a server can send one or more Set-Cookie headers with the response. The browser usually stores the cookie...
Read more >How to change the Path attribute of the JSESSIONID cookie
The Path attribute of the JSESSIONID cookie can be changed within the web.xml for the webapp (e.g. <PASOE_instance>\webapps\MyApp\WEB-INF\web.
Read more >Handling Cookies and a Session in a Java Servlet - Baeldung
2.1. Create a Cookie · 2.2. Set the Cookie Expiration Date · 2.3. Set the Cookie Domain · 2.4. Set the Cookie Path...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
When 3.0 of springfox is released… there isnt a planned date yet for it
any updates on this? really need this one.