我有手動驗證春季安全如下代碼:手動驗證春季安全
Authentication authentication = new UsernamePasswordAuthenticationToken(username, password);
SecurityContextHolder.getContext().setAuthentication(authenticationManager.authenticate(authentication));
在這些代碼中,場username
和password
是在我的系統真正的賬戶。
但是將真實信息放在代碼中很敏感。
我的意思是,我們創建了一個假帳戶,並授予他們權力,如USER
或ADMIN
我的問題是:
反正有人工驗證,而不使用真實賬戶。
用戶名和密碼分別是「usernameReal」和「passwordReal」。對於那個很抱歉! –