Authen-ModAuthToken

 view release on metacpan or  search on metacpan

eg/mod_auth_token_example.pl  view on Meta::CPAN

	## A sample mod-auth-token protected Location.
	## see  http://code.google.com/p/mod-auth-token/ for more details.
	##

	Alias "$prefix"  "/my/protected/directory"
	<Location "/protected">
		AuthTokenSecret       "$secret"
		AuthTokenPrefix       "$prefix/"

		## Number of seconds that a Token is valid:
		AuthTokenTimeout      14400

		## Change to "on" to limit by requesting IP.
		AuthTokenLimitByIp    off
	</Location>


EOF

	exit 0;
}

eg/mod_auth_token_example.pl  view on Meta::CPAN

	## A sample mod-auth-token protected Location.
	## see  http://code.google.com/p/mod-auth-token/ for more details.
	##

	Alias "/resources"  "/my/protected/directory"
	<Location "/protected">
		AuthTokenSecret       "12345678"
		AuthTokenPrefix       "/resources/"

		## Number of seconds that a Token is valid:
		AuthTokenTimeout      14400

		## Change to "on" to limit by requesting IP.
		AuthTokenLimitByIp    off
	</Location>


EOF
exit 0;
}

lib/Authen/ModAuthToken.pm  view on Meta::CPAN


In your Apache's configuration, define the following:

	## (your module's path may vary)
	LoadModule auth_token_module  /usr/lib/apache2/modules/mod_auth_token.so

	Alias "/protected"  "/my/protected/directory"
	<Location "/protected">
		AuthTokenSecret       "FlyingMonkeys"
		AuthTokenPrefix       /protected/
		AuthTokenTimeout      14400
	</Location>


In a CGI script, use the following:

	use Authen::ModAuthToken qw/generate_mod_auth_token/;

	## If the file wasn't protected with "mod-auth-token",
	## its URL would have been:
	##   http://my.server.com/protected/myfile.txt



( run in 0.231 second using v1.01-cache-2.11-cpan-4d50c553e7e )