All Downloads are FREE. Search and download functionalities are using the official Maven repository.

Eiffel.framework.auth.http_basic_auth.mustache Maven / Gradle / Ivy

There is a newer version: 7.8.0
Show newest version
{{>noteinfo}}

class
	HTTP_BASIC_AUTH

inherit

	AUTHENTICATION

feature -- Access

	user_name: detachable STRING_32
			-- user name.

	password: detachable STRING_32
			-- password.

feature -- Element Change	

	set_user_name (a_name: STRING_32)
			-- Set `user_name' with `a_name'.
		do
			user_name := a_name
		ensure
			user_name_set: user_name = a_name
		end

	set_password (a_password: STRING_32)
			-- Set `password' with `a_password'.
		do
			password := a_password
		ensure
			password_set: password = a_password
		end

feature -- Access

	apply_to_params(a_query_params: LIST [TUPLE [name:STRING; value:STRING]]; a_header_params: STRING_TABLE [STRING])
   			-- .
		do
			if
				attached user_name as l_username and then
				attached password as l_password
			then
				a_header_params.force ("Basic " + (create {BASE64}).encoded_string (l_username + ":" + l_password) , "Authorization")
			end
   		end

end




© 2015 - 2024 Weber Informatics LLC | Privacy Policy