Coverage Report - ca.uhn.hl7v2.hoh.auth.SingleCredentialServerCallback
 
Classes in this File Line Coverage Branch Coverage Complexity
SingleCredentialServerCallback
100%
5/5
50%
2/4
1.5
 
 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 String myUsername;
 12  
         private String myPassword;
 13  
 
 14  100
         public SingleCredentialServerCallback(String theUsername, String thePassword) {
 15  100
                 myUsername = theUsername;
 16  100
                 myPassword = thePassword;
 17  100
         }
 18  
         
 19  
         /**
 20  
          * {@inheritDoc}
 21  
          */
 22  
         public boolean authorize(String theUriPath, String theUsername, String thePassword) {
 23  125
                 return StringUtils.equals(myUsername, theUsername) && StringUtils.equals(myPassword, thePassword);
 24  
         }
 25  
 
 26  
 }