Skip to content

SharedSecretAuthentication

tylertreat edited this page Jan 17, 2013 · 2 revisions

SharedSecretAuthentication is an AuthenticationStrategy implementation used for token-based/shared-secret web service authentication. Shared-secret authentication consists of a token name and a token (shared secret) in the form of tokenName=myToken. Thus, this authentication string is typically appended to the URI of a web service request as a query-string parameter, such as http://localhost/webservice/endpoint?token=5f4dcc3b5aa765d61d8327deb882cf99, or as a request header.

Configuring SharedSecretAuthentication

SharedSecretAuthentication can be configured as a header or query-string parameter:

auth.setHeader(true);

The token name and token itself can also be explicitly set:

auth.setTokenName("token");
auth.setToken("foobar");

Alternatively, a TokenGenerator can be set:

auth.setTokenGenerator(new MyTokenGenerator());
Clone this wiki locally