Package org.globus.gsi.gssapi.auth

# Class IdentityAuthorization

java.lang.Object
org.globus.gsi.gssapi.auth.Authorization
org.globus.gsi.gssapi.auth.GSSAuthorization
org.globus.gsi.gssapi.auth.IdentityAuthorization

public class IdentityAuthorization extends GSSAuthorization
Implements a simple identity authorization mechanism. The given identify is compared with the peer's identity.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected String`
`_identity`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`IdentityAuthorization()`
Constructor used by superclasses.
``
`IdentityAuthorization(String identity)`
Creates a new instance of this class with given expected identity.

## Method Summary

Modifier and Type
Method
Description
`void`
`authorize(GSSContext context, String host)`
Performs identity authorization.
`boolean`
`equals(Object o)`
`GSSName`
`getExpectedName(GSSCredential cred, String host)`
Returns expected `GSSName` used for authorization purposes.
`String`
`getIdentity()`
Returns the expected identity.
`int`
`hashCode()`
`void`
`setIdentity(String identity)`
Sets the expected identity for the authorization check.

### Methods inherited from class org.globus.gsi.gssapi.auth.Authorization

`generateAuthorizationException`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### _identity

protected String _identity

## Constructor Details

### IdentityAuthorization

protected IdentityAuthorization()
Constructor used by superclasses.

### IdentityAuthorization

public IdentityAuthorization(String identity)
Creates a new instance of this class with given expected identity.

Parameters:
  `identity` - the expected identity. Must not be null.

## Method Details

### setIdentity

public void setIdentity(String identity)
Sets the expected identity for the authorization check.

Parameters:
  `identity` - the expected identity. Must not be null.

### getIdentity

public String getIdentity()
Returns the expected identity.

Returns:
  the expected identity.

### getExpectedName

public GSSName getExpectedName(GSSCredential cred, String host) throws GSSException
Description copied from class: `GSSAuthorization`
Returns expected `GSSName` used for authorization purposes. Can returns null for self authorization.

Specified by:
  `getExpectedName` in class `GSSAuthorization`
Parameters:
  `cred` - credentials used
  `host` - host address of the peer.
Throws:
  `GSSException` - if unable to create the name.

### authorize

public void authorize(GSSContext context, String host) throws AuthorizationException
Performs identity authorization. The given identity is compared with the peer's identity.

Specified by:
  `authorize` in class `Authorization`
Parameters:
  `context` - the security context
  `host` - host address of the peer.
Throws:
  `AuthorizationException` - if the peer's identity does not match the expected identity.

### equals

public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`