AuthDB

AuthDB class is a front-end to the AuthDB MySQL Database (via SQLAlchemy)

class DIRAC.FrameworkSystem.DB.AuthDB.AuthDB

Bases: SQLAlchemyDB

AuthDB class is a front-end to the OAuth Database

__init__()

Constructor

addSession(data)

Add new session

Parameters:

data (dict) – session metadata

Returns:

S_OK(dict)/S_ERROR()

delete(table, params)
Parameters:
  • table (str) – table from where to delete

  • params (dict) – dictionary of which line(s) to delete

Returns:

S_OK() || S_ERROR()

generateRSAKeys()

Generate an RSA keypair with an exponent of 65537 in PEM format

Returns:

S_OK/S_ERROR

getActiveKeys(kid=None)

Get active keys

Parameters:

kid (str) – key ID

Returns:

S_OK(list)/S_ERROR()

getCSOption(optionName, defaultValue=None)
getCredentialByRefreshToken(tokenID)

Get refresh token credential

Parameters:

tokenID (str) – refresh token ID

Returns:

S_OK(dict)/S_ERROR()

getKeySet()

Get key set

Returns:

S_OK(obj)/S_ERROR()

getPrivateKey(kid=None)

Get private key

Parameters:

kid (str) – key ID

Returns:

S_OK(obj)/S_ERROR()

getSession(sessionID)

Get client

Parameters:

sessionID (str) – session id

Returns:

S_OK(dict)/S_ERROR()

getSessionByUserCode(userCode)

Get client

Parameters:

userCode (str) – user code

Returns:

S_OK(dict)/S_ERROR()

insert(table, params)

Inserts params in the DB.

Parameters:
  • table (str) – table where to insert

  • params (dict) – Dictionary to fill a single line

Returns:

S_OK() || S_ERROR()

removeKeys()

Get active keys

Returns:

S_OK(list)/S_ERROR()

removeSession(sessionID)

Remove session

Parameters:

sessionID (str) – session id

Returns:

S_OK()/S_ERROR()

revokeRefreshToken(tokenID)

Revoke refresh token

Parameters:

tokenID (str) – refresh token ID

Returns:

S_OK()/S_ERROR()

select(table, params)

Uses params to build conditional SQL statement ( WHERE … ).

Parameters:
params - dict

arguments for the mysql query ( must match table columns ! ).

Returns:

S_OK() || S_ERROR()

storeRefreshToken(token, tokenID=None)

Store refresh token

Parameters:
  • token (dict) – tokens as dict

  • tokenID (str) – token ID

Returns:

S_OK(dict)/S_ERROR()

updateSession(data, sessionID)

Update session data

Parameters:
  • data (dict) – data info

  • sessionID (str) – sessionID

Returns:

S_OK(object)/S_ERROR()

class DIRAC.FrameworkSystem.DB.AuthDB.AuthSession(**kwargs)

Bases: Base

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

client_id
device_code
expires_at
expires_in
id
interval
metadata: MetaData = MetaData()
registry: RegistryType = <sqlalchemy.orm.decl_api.registry object>
scope
state
uri
user_code
user_id
username
verification_uri
verification_uri_complete
class DIRAC.FrameworkSystem.DB.AuthDB.JWK(**kwargs)

Bases: Base

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

expires_at
key
kid
metadata: MetaData = MetaData()
registry: RegistryType = <sqlalchemy.orm.decl_api.registry object>
class DIRAC.FrameworkSystem.DB.AuthDB.RefreshToken(**kwargs)

Bases: Base

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

access_token
issued_at
jti
metadata: MetaData = MetaData()
refresh_token
registry: RegistryType = <sqlalchemy.orm.decl_api.registry object>