| 1 |
/* |
| 2 |
* Copyright 1999-2010 University of Chicago |
| 3 |
* |
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in |
| 5 |
* compliance with the License. You may obtain a copy of the License at |
| 6 |
* |
| 7 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
* |
| 9 |
* Unless required by applicable law or agreed to in writing, software distributed under the License is |
| 10 |
* distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 11 |
* express or implied. |
| 12 |
* |
| 13 |
* See the License for the specific language governing permissions and limitations under the License. |
| 14 |
*/ |
| 15 |
package org.globus.gsi.gssapi.auth; |
| 16 |
|
| 17 |
import org.ietf.jgss.GSSContext; |
| 18 |
import org.ietf.jgss.GSSCredential; |
| 19 |
import org.ietf.jgss.GSSException; |
| 20 |
import org.ietf.jgss.GSSName; |
| 21 |
|
| 22 |
import org.apache.commons.logging.Log; |
| 23 |
import org.apache.commons.logging.LogFactory; |
| 24 |
|
| 25 |
/** |
| 26 |
* Implements the simplest authorization mechanism that does |
| 27 |
* not do any authorization checks. |
| 28 |
*/ |
| 29 |
public class NoAuthorization extends GSSAuthorization { |
| 30 |
|
| 31 |
private static Log logger = |
| 32 |
LogFactory.getLog(NoAuthorization.class.getName()); |
| 33 |
|
| 34 |
private static NoAuthorization authorization; |
| 35 |
|
| 36 |
/** |
| 37 |
* Returns a single instance of this class. |
| 38 |
* |
| 39 |
* @return the instance of this class. |
| 40 |
*/ |
| 41 |
public synchronized static NoAuthorization getInstance() { |
| 42 |
if (authorization == null) { |
| 43 |
authorization = new NoAuthorization(); |
| 44 |
} |
| 45 |
return authorization; |
| 46 |
} |
| 47 |
|
| 48 |
/** |
| 49 |
* Always returns null. |
| 50 |
*/ |
| 51 |
public GSSName getExpectedName(GSSCredential cred, String host) |
| 52 |
throws GSSException { |
| 53 |
return null; |
| 54 |
} |
| 55 |
|
| 56 |
/** |
| 57 |
* Performs no authorization checks. The function is always |
| 58 |
* successful. It does not throw any exceptions. |
| 59 |
* |
| 60 |
*/ |
| 61 |
public void authorize(GSSContext context, String host) |
| 62 |
throws AuthorizationException { |
| 63 |
logger.debug("Authorization: NONE"); |
| 64 |
} |
| 65 |
|
| 66 |
} |