Skip to content

Commit 323d7fe

Browse files
Merge pull request kaazing#33 from michaelcretzman/remove-Application-Negotiate
deprecating Application Negotiate
2 parents 55bf13c + 38bb249 commit 323d7fe

2 files changed

Lines changed: 13 additions & 14 deletions

File tree

ws/doc/p_dev_java_secure.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Secure Your Java and Android Clients
33

44
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.
55

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.
77

88
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).
99

@@ -116,7 +116,7 @@ final LoginHandler loginHandler = new LoginHandler() {
116116
return new PasswordAuthentication(username, password);
117117
}
118118
};
119-
119+
120120
wsFactory = WebSocketFactory.createWebSocketFactory();
121121
wsFactory.setDefaultChallengeHandler(
122122
BasicChallengeHandler.create().setLoginHandler(loginHandler);
@@ -129,7 +129,7 @@ Creating a Custom Challenge Handler
129129

130130
There are two methods used in ChallengeHandler:
131131

132-
- `canHandle(ChallengeRequest challengeRequest)` determines if the challenge handler can handle the authentication scheme required by the Gateway (for example, Basic, Application Basic, Negotiate, Application Negotiate, or Application Token). The method takes a ChallengeRequest object containing a challenge and returns true if the challenge handler has the potential to respond meaningfully to the challenge. If this method determines that the challenge handler can handle the authentication scheme, it returns true and the `handle()` method is used. If this 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, Application Basic, Negotiate, or Application Token). The method takes a ChallengeRequest object containing a challenge and returns true if the challenge handler has the potential to respond meaningfully to the challenge. If this method determines that the challenge handler can handle the authentication scheme, it returns true and the `handle()` method is used. If this method returns false, the ChallengeHandler class (that contains all of the registered individual ChallengeHandler objects) continues looking for a ChallengeHandler to handle the request.
133133
- `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. The ChallengeResponse 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`.
134134

135135
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).
@@ -140,11 +140,11 @@ After you have developed your own challenge handler, you can install it for futu
140140

141141
1. Add a JAR file with your `BasicChallengeHandler` implementation to your classpath parameter before the KAAZING Gateway Java client libraries.
142142
2. Ensure the JAR file contains the following file inside:
143-
143+
144144
```
145145
META-INF/services/org.kaazing.gateway.client.security.BasicChallengeHander
146146
```
147-
147+
148148
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 [Service Loader](http://docs.oracle.com/javase/7/docs/api/java/util/ServiceLoader.html) documentation.
149149

150150
Managing Log In Attempts
@@ -156,7 +156,7 @@ The following example demonstrates how to stop the Gateway from issuing further
156156

157157
``` java
158158
/**
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.
160160
*/
161161
private static int maxRetries = 2; //max retries allowed for wrong credentials
162162
private int retry = 0; // retry counter
@@ -185,7 +185,7 @@ private void setupLoginHandler(final Frame parentFrame, String locStr) {
185185
// Receive messages using WebSocketMessageReader.
186186
final WebSocketMessageReader messageReader = webSocket.getMessageReader();
187187
}
188-
}
188+
}
189189
catch (Exception e1) {
190190
retry = 0; //reset retry counter
191191
e1.printStackTrace();
@@ -242,7 +242,7 @@ public class JmsPanel extends javax.swing.JPanel implements ActionListener, Mess
242242
try {
243243
String url = location.getText();
244244
logMessage("CONNECT: " + url);
245-
245+
246246
if (connectionFactory instanceof JmsConnectionFactory) {
247247
JmsConnectionFactory stompConnectionFactory = (JmsConnectionFactory)connectionFactory;
248248
// initialize the login handler for the target location
@@ -331,4 +331,3 @@ wsFactory.setDefaultChallengeHandler(WebSocketDemoChallengeHandler.create()
331331
```
332332

333333
At this 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 for Kerberos credentials for the challenge response. If the user enters credentials with any other realm the `kb.hostname.com` KDC will be used to ask for Kerberos 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).
334-

ws/ws/src/main/java/org/kaazing/net/auth/ChallengeRequest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
/**
22
* Copyright (c) 2007-2014 Kaazing Corporation. All rights reserved.
3-
*
3+
*
44
* Licensed to the Apache Software Foundation (ASF) under one
55
* or more contributor license agreements. See the NOTICE file
66
* distributed with this work for additional information
77
* regarding copyright ownership. The ASF licenses this file
88
* to you under the Apache License, Version 2.0 (the
99
* "License"); you may not use this file except in compliance
1010
* with the License. You may obtain a copy of the License at
11-
*
11+
*
1212
* http://www.apache.org/licenses/LICENSE-2.0
13-
*
13+
*
1414
* Unless required by applicable law or agreed to in writing,
1515
* software distributed under the License is distributed on an
1616
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -32,7 +32,7 @@
3232
* so we model the authentication scheme and parameters in this class.
3333
* <p/>
3434
* This class is also responsible for detecting and adapting the {@code Application Basic}
35-
* and {@code Application Negotiate} authentication schemes into their {@code Basic} and {@code Negotiate}
35+
* and {@code Negotiate} authentication schemes into their {@code Basic} and {@code Negotiate}
3636
* counterpart authentication schemes.
3737
*/
3838
public class ChallengeRequest {
@@ -66,7 +66,7 @@ public ChallengeRequest(String location, String challenge) {
6666

6767
this.location = location;
6868
this.authenticationParameters = null;
69-
69+
7070
int space = challenge.indexOf(' ');
7171
if ( space == -1 ) {
7272
this.authenticationScheme = challenge;

0 commit comments

Comments
 (0)