View Javadoc
1   package ca.uhn.hl7v2.hoh.auth;
2   
3   import ca.uhn.hl7v2.hoh.api.IAuthorizationServerCallback;
4   import ca.uhn.hl7v2.hoh.util.StringUtils;
5   
6   /**
7    * Authorization Callback which validates a single username and password
8    */
9   public class SingleCredentialServerCallback implements IAuthorizationServerCallback {
10  
11  	private final String myUsername;
12  	private final String myPassword;
13  
14  	public SingleCredentialServerCallback(String theUsername, String thePassword) {
15  		myUsername = theUsername;
16  		myPassword = thePassword;
17  	}
18  	
19  	/**
20  	 * {@inheritDoc}
21  	 */
22  	public boolean authorize(String theUriPath, String theUsername, String thePassword) {
23  		return StringUtils.equals(myUsername, theUsername) && StringUtils.equals(myPassword, thePassword);
24  	}
25  
26  }