fixed authentication

This commit is contained in:
Main
2016-02-17 14:56:53 +03:00
parent 84debbda28
commit 8615ac1d1e
3 changed files with 11 additions and 19 deletions

View File

@@ -48,7 +48,8 @@ public class AuthConfiguration extends WebSecurityConfigurerAdapter {
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable()
.authorizeRequests()
.antMatchers("/**").permitAll()
.antMatchers("/index.html", "/", "/**.js", "/**.css").permitAll()
.antMatchers(HttpMethod.POST, "/customers", "/login").permitAll()
.anyRequest().authenticated().and()
.addFilterBefore(new StatelessAuthenticationFilter(tokenAuthenticationService), UsernamePasswordAuthenticationFilter.class);
}

View File

@@ -25,9 +25,9 @@ public class CustomerController {
}
@RequestMapping(method = RequestMethod.POST)
public Observable<CustomerResponse> createCustomer(@Validated @RequestBody CustomerInfo request) {
return customerService.createCustomer(request)
.map(entityAndEventInfo -> new CustomerResponse(entityAndEventInfo.getEntityIdentifier().getId(), request));
public Observable<CustomerResponse> createCustomer(@Validated @RequestBody CustomerInfo customer) {
return customerService.createCustomer(customer)
.map(entityAndEventInfo -> new CustomerResponse(entityAndEventInfo.getEntityIdentifier().getId(), customer));
}
@RequestMapping(value = "/{id}/toaccounts", method = RequestMethod.POST)

View File

@@ -150,7 +150,7 @@
"description": "customer",
"required": true,
"schema": {
"$ref": "#/definitions/CreateCustomerRequest"
"$ref": "#/definitions/CustomerInfo"
}
}
],
@@ -260,6 +260,9 @@
"CustomerInfo": {
"required": [ "email" ],
"properties": {
"name": {
"$ref": "#/definitions/Name"
},
"email": {
"type": "string"
},
@@ -315,26 +318,14 @@
}
}
},
"CreateCustomerRequest": {
"required": [ "email", "ssn", "phoneNumber" ],
"Name": {
"required": [ "firstName", "lastName" ],
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"email": {
"type": "string"
},
"ssn": {
"type": "string"
},
"phoneNumber": {
"type": "string"
},
"address": {
"$ref": "#/definitions/Address"
}
}
},