Package no.nsd.qddt.security.web
Class AuthController
- java.lang.Object
-
- no.nsd.qddt.domain.AbstractController
-
- no.nsd.qddt.security.web.AuthController
-
@RestController public class AuthController extends AbstractController
AuthController provides signup, signin and token refresh methods
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
REFRESH_TOKEN_URL
static java.lang.String
SIGNIN_URL
static java.lang.String
SIGNUP_URL
-
Fields inherited from class no.nsd.qddt.domain.AbstractController
LOG
-
-
Constructor Summary
Constructors Constructor Description AuthController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.http.ResponseEntity
createAuthenticationToken(JwtAuthenticationRequest authenticationRequest)
Adds new user and returns authentication tokenorg.springframework.http.ResponseEntity
getAuthenticationToken(JwtAuthenticationRequest authenticationRequest)
Returns authentication token for given userorg.springframework.http.ResponseEntity
refreshAuthenticationToken(javax.servlet.http.HttpServletRequest request)
Refreshes tokenvoid
setAuthenticationManager(org.springframework.security.authentication.AuthenticationManager authenticationManager)
Injects AuthenticationManager instancevoid
setJwtTokenUtil(JwtUtil jwtUtil)
Injects JwtUtil instancevoid
setUserDetailsService(QDDTUserDetailsService userDetailsService)
Injects UserDetailsService instancevoid
setUserService(UserService userService)
Injects UserService instance
-
-
-
Field Detail
-
SIGNUP_URL
public static final java.lang.String SIGNUP_URL
- See Also:
- Constant Field Values
-
SIGNIN_URL
public static final java.lang.String SIGNIN_URL
- See Also:
- Constant Field Values
-
REFRESH_TOKEN_URL
public static final java.lang.String REFRESH_TOKEN_URL
- See Also:
- Constant Field Values
-
-
Method Detail
-
setAuthenticationManager
@Autowired public void setAuthenticationManager(org.springframework.security.authentication.AuthenticationManager authenticationManager)
Injects AuthenticationManager instance- Parameters:
authenticationManager
- to inject
-
setJwtTokenUtil
@Autowired public void setJwtTokenUtil(JwtUtil jwtUtil)
Injects JwtUtil instance- Parameters:
jwtUtil
- to inject
-
setUserDetailsService
@Autowired public void setUserDetailsService(QDDTUserDetailsService userDetailsService)
Injects UserDetailsService instance- Parameters:
userDetailsService
- to inject
-
setUserService
@Autowired public void setUserService(UserService userService)
Injects UserService instance- Parameters:
userService
- to inject
-
createAuthenticationToken
@RequestMapping(value="auth/signup", method=POST) public org.springframework.http.ResponseEntity createAuthenticationToken(@RequestBody JwtAuthenticationRequest authenticationRequest) throws org.springframework.security.core.AuthenticationException
Adds new user and returns authentication token- Parameters:
authenticationRequest
- request with username, email and password fields- Returns:
- generated JWT
- Throws:
org.springframework.security.core.AuthenticationException
-
getAuthenticationToken
@RequestMapping(value="auth/signin", method=POST) public org.springframework.http.ResponseEntity getAuthenticationToken(@RequestBody JwtAuthenticationRequest authenticationRequest) throws org.springframework.security.core.AuthenticationException
Returns authentication token for given user- Parameters:
authenticationRequest
- with username and password- Returns:
- generated JWT
- Throws:
org.springframework.security.core.AuthenticationException
-
refreshAuthenticationToken
@RequestMapping("auth/token/refresh") public org.springframework.http.ResponseEntity refreshAuthenticationToken(javax.servlet.http.HttpServletRequest request)
Refreshes token- Parameters:
request
- with old JWT- Returns:
- Refreshed JWT
-
-