001package ca.uhn.hl7v2.hoh.auth;
002
003import ca.uhn.hl7v2.hoh.api.IAuthorizationServerCallback;
004import ca.uhn.hl7v2.hoh.util.StringUtils;
005
006/**
007 * Authorization Callback which validates a single username and password
008 */
009public class SingleCredentialServerCallback implements IAuthorizationServerCallback {
010
011        private String myUsername;
012        private String myPassword;
013
014        public SingleCredentialServerCallback(String theUsername, String thePassword) {
015                myUsername = theUsername;
016                myPassword = thePassword;
017        }
018        
019        /**
020         * {@inheritDoc}
021         */
022        public boolean authorize(String theUriPath, String theUsername, String thePassword) {
023                return StringUtils.equals(myUsername, theUsername) && StringUtils.equals(myPassword, thePassword);
024        }
025
026}