Skip to content

Commit

Permalink
private variables to bean methods
Browse files Browse the repository at this point in the history
  • Loading branch information
selvaebi committed Mar 25, 2019
1 parent 15a25fd commit e631258
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,15 @@ public class SwaggerConfiguration {
@Autowired
private SwaggerApiInfoProperties swaggerApiInfoProperties;

private SecurityReference securityReference = SecurityReference.builder()
.reference("Authorization").scopes(new AuthorizationScope[0]).build();
@Bean
public SecurityReference securityReference() {
return SecurityReference.builder().reference("Authorization").scopes(new AuthorizationScope[0]).build();
}

private SecurityContext securityContext = SecurityContext.builder()
.securityReferences(Arrays.asList(securityReference)).build();
@Bean
public SecurityContext securityContext() {
return SecurityContext.builder().securityReferences(Arrays.asList(securityReference())).build();
}

@Bean
public Docket metadataApi() {
Expand Down Expand Up @@ -102,7 +106,7 @@ public Docket metadataApi() {
.directModelSubstitute(LocalDate.class, String.class)
.genericModelSubstitutes(ResponseEntity.class)
.securitySchemes(Arrays.asList(new ApiKey("Authorization", "Authorization", "header")))
.securityContexts(Arrays.asList(securityContext))
.securityContexts(Arrays.asList(securityContext()))
.alternateTypeRules(getSubstitutionRules());
}

Expand Down

0 comments on commit e631258

Please sign in to comment.