Package uk.ac.starlink.auth

# Class AuthStatus

java.lang.Object
uk.ac.starlink.auth.AuthStatus

public class AuthStatus extends Object
Characterises the authentication associated with a connection.

Since:
  7 Feb 2022
Author:
  Mark Taylor

## Field Summary

Fields
Modifier and Type
Field
Description
`static final AuthStatus`
`NO_AUTH`
Connection with no possible or actual authentication.

## Constructor Summary

Constructors
Constructor
Description
`AuthStatus(AuthType authType)`
Constructs an AuthStatus with a given type but no actual authentication.
`AuthStatus(AuthType authType, boolean isAuthenticated, String authId)`
Constructs an AuthStatus with given characteristics.

## Method Summary

Modifier and Type
Method
Description
`String`
`getAuthenticatedId()`
Returns the authenticated user ID for this connection.
`AuthType`
`getAuthType()`
Returns the authentication type for this connection.
`String`
`getIdentityString()`
Returns a non-null string that can be used to characterise the user identity.
`boolean`
`isAuthenticated()`
Indicates whether authentication has been established.
`String`
`toString()`

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

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### NO_AUTH

public static final AuthStatus NO_AUTH
Connection with no possible or actual authentication.

## Constructor Details

### AuthStatus

public AuthStatus(AuthType authType)
Constructs an AuthStatus with a given type but no actual authentication.

Parameters:
  `authType` - authentication type

### AuthStatus

public AuthStatus(AuthType authType, boolean isAuthenticated, String authId)
Constructs an AuthStatus with given characteristics.

Parameters:
  `authType` - authentication type
  `isAuthenticated` - true if authentication has been established
  `authId` - user identifier for authenticated identity; should normally be non-null if isAuthenticated is true, but not guaranteed to be

## Method Details

### getAuthType

public AuthType getAuthType()
Returns the authentication type for this connection.

Returns:
  authentication type

### isAuthenticated

public boolean isAuthenticated()
Indicates whether authentication has been established.

Returns:
  true for authenticated

### getAuthenticatedId

public String getAuthenticatedId()
Returns the authenticated user ID for this connection. Usually this will be non-null iff `isAuthenticated()` is true, but that's not guaranteed.

Returns:
  user ID

### getIdentityString

public String getIdentityString()
Returns a non-null string that can be used to characterise the user identity.

Returns:
  non-null identity description

### toString

public String toString()

Overrides:
  `toString` in class `Object`