You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ws/doc/p_dev_java_secure.md
+8-9Lines changed: 8 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ Secure Your Java and Android Clients
3
3
4
4
This topic provides information on how to add user authentication functionality to Java and Android clients. The Java and Android Client APIs use the same authentication classes and methods.
5
5
6
-
A challenge handler is a constructor used in an application to respond to authentication challenges from the Gateway when the application attempts to access a protected resource. Each of the resources protected by the Gateway is configured with a different authentication scheme (for example, Basic, Application Basic, Application Negotiate, or Application Token), and your application requires a challenge handler for each of the schemes that it will encounter or a single challenge handler that will respond to all challenges. Also, you can add a dispatch challenge handler to route challenges to specific challenge handlers according to the URI of the requested resource.
6
+
A challenge handler is a constructor used in an application to respond to authentication challenges from the Gateway when the application attempts to access a protected resource. Each of the resources protected by the Gateway is configured with a different authentication scheme (for example, Basic, Application Basic, or Application Token), and your application requires a challenge handler for each of the schemes that it will encounter or a single challenge handler that will respond to all challenges. Also, you can add a dispatch challenge handler to route challenges to specific challenge handlers according to the URI of the requested resource.
7
7
8
8
For information about each authentication scheme type, see [Configure the HTTP Challenge Scheme](https://github.com/kaazing/gateway/blob/develop/doc/security/p_authentication_config_http_challenge_scheme.md).
9
9
@@ -116,7 +116,7 @@ final LoginHandler loginHandler = new LoginHandler() {
@@ -129,7 +129,7 @@ Creating a Custom Challenge Handler
129
129
130
130
There are two methods used in ChallengeHandler:
131
131
132
-
- `canHandle(ChallengeRequest challengeRequest)` determines if the challenge handler can handle the authentication scheme required by the Gateway (for example, Basic, ApplicationBasic, Negotiate, ApplicationNegotiate, or ApplicationToken).The method takes a ChallengeRequest object containing a challenge and returns trueif the challenge handler has the potential to respond meaningfully to the challenge. Ifthis method determines that the challenge handler can handle the authentication scheme, it returns true and the `handle()` method is used. Ifthis method returns false, the ChallengeHandler class (that contains all of the registered individual ChallengeHandler objects) continues looking for a ChallengeHandler to handle the request.
132
+
- `canHandle(ChallengeRequest challengeRequest)` determines if the challenge handler can handle the authentication scheme required by the Gateway (for example, Basic, ApplicationBasic, Negotiate, or ApplicationToken).The method takes a ChallengeRequest object containing a challenge and returns trueif the challenge handler has the potential to respond meaningfully to the challenge. Ifthis method determines that the challenge handler can handle the authentication scheme, it returns true and the `handle()` method is used. Ifthis method returns false, the ChallengeHandler class (that contains all of the registered individual ChallengeHandler objects) continues looking for a ChallengeHandler to handle the request.
133
133
- `handle(ChallengeRequest challengeRequest)` handles the authentication challenge by returning a challenge response. Typically, the challenge response invokes a login handler to collect user credentials and transforms that information into a ChallengeResponse object. TheChallengeResponse sends the credentials to the Gateway in an Authorization header and notifies the Gateway on what challenge handler to use for future requests. If `handle()` cannot create a challenge response, it returns `null`.
134
134
135
135
For information about each authentication scheme type, see [Configure the HTTPChallengeScheme](https://github.com/kaazing/gateway/blob/develop/doc/security/p_authentication_config_http_challenge_scheme.md).
@@ -140,11 +140,11 @@ After you have developed your own challenge handler, you can install it for futu
140
140
141
141
1.Add a JAR file with your `BasicChallengeHandler` implementation to your classpath parameter before the KAAZINGGatewayJava client libraries.
142
142
2.Ensure the JAR file contains the following file inside:
The contents of the file should consist of a single line listing the fully-qualified name of your new implementation class (for example, `fully.qualified.challenge.handler.impl.MyChallengeHandler`).For more information, see the [ServiceLoader](http://docs.oracle.com/javase/7/docs/api/java/util/ServiceLoader.html) documentation.
149
149
150
150
ManagingLogInAttempts
@@ -156,7 +156,7 @@ The following example demonstrates how to stop the Gateway from issuing further
156
156
157
157
``` java
158
158
/**
159
-
* Sets up the login handler for responding to "Application Basic" or "Application Negotiate" challenges.
159
+
* Sets up the login handler for responding to "Application Basic" challenges.
160
160
*/
161
161
privatestaticint maxRetries =2; //max retries allowed for wrong credentials
Atthis point, any user attempting to access `servergw.hostname.com:8000/echo` will be challenged using a `KerberosChallengeHandler` instance. If the user enters credentials with the ATHENA.MIT.EDU realm the realm-specific `athena.hostname.com` KDC will be used to ask forKerberos credentials for the challenge response. If the user enters credentials with any other realm the `kb.hostname.com` KDC will be used to ask forKerberos credentials. All requests to either KDC will be for the service name `HTTP/servergw.hostname.com` (indicating access to that HTTP server is the service for which Kerberos credentials are being requested).
0 commit comments