Guest User

Untitled

a guest
Nov 23rd, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. public class AuthenticationFilter extends BrokerFilter {
  2. public AuthenticationFilter(Broker next) {
  3. super(next);
  4. }
  5.  
  6. @Override
  7. public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception {
  8. String username = info.getUserName() ;
  9. String password = info.getPassword() ;
  10. if (username.equals("EXAMPLE_USER_NAME") && password.equals("EXAMPLE_PASSWORD")) {
  11. System.out.println("Authentication Success .");
  12. super.addConnection(context, info);
  13. } else {
  14. System.out.println("Authentication Failed for clientID : " + info.getClientId());
  15. throw new SecurityException();
  16. }
  17. }
  18. }
  19.  
  20. Authentication Failed for clientID : 1112
  21. Authentication Failed for clientID : 1112
Add Comment
Please, Sign In to add comment