public class D1AuthHelper
extends java.lang.Object
Constructor and Description |
---|
D1AuthHelper(javax.servlet.http.HttpServletRequest request,
org.dataone.service.types.v1.Identifier requestIdentifier,
java.lang.String notAuthorizedCode,
java.lang.String serviceFailureCode)
Each instance should correspond to a single request.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkExpandedPermissions(org.dataone.service.types.v1.Session session,
org.dataone.service.types.v2.SystemMetadata sysmeta,
org.dataone.service.types.v1.Permission permission)
Compare all the session subjects against the expanded subjects (from listSubjects)
of the object rightsholder.
|
void |
doAdminAuthorization(org.dataone.service.types.v1.Session session)
Does MN/CN admin authorization
|
void |
doAuthoritativeMNAuthorization(org.dataone.service.types.v1.Session session,
org.dataone.service.types.v2.SystemMetadata sysmeta)
Does local and AuthMN admin authorization
|
void |
doCNOnlyAuthorization(org.dataone.service.types.v1.Session session)
Does only localNode(CN)/CN authorization
|
void |
doGetSysmetaAuthorization(org.dataone.service.types.v1.Session session,
org.dataone.service.types.v2.SystemMetadata sysmeta,
org.dataone.service.types.v1.Permission permission)
used by getSystemMetadata, describe, and getPackage, the latter two by delegation to getSystemMetadata
Very similar to doIsAuthorized, but also allows replica nodes administrative access.
|
void |
doIsAuthorized(org.dataone.service.types.v1.Session session,
org.dataone.service.types.v2.SystemMetadata sysmeta,
org.dataone.service.types.v1.Permission permission)
Performs all authorization steps used by isAuthorized.
|
void |
doUpdateAuth(org.dataone.service.types.v1.Session session,
org.dataone.service.types.v2.SystemMetadata sysmeta,
org.dataone.service.types.v1.Permission permission,
org.dataone.service.types.v1.NodeReference localNodeId)
The locus of updates is limited to the authoritativeMN.
|
static boolean |
expandRightsHolder(org.dataone.service.types.v1.Subject rightHolder,
org.dataone.service.types.v1.Subject sessionSubject)
Check if the given userSession is the member of the right holder group (if the right holder is a group subject).
|
protected org.dataone.service.types.v2.NodeList |
getCNNodeList()
A centralized point for accessing the CN Nodelist,
to make it easier to cache the nodelist in the future,
if it's seen as helpful performance-wise
|
protected boolean |
isAuthoritativeMNodeAdmin(org.dataone.service.types.v1.Session session,
org.dataone.service.types.v1.NodeReference authoritativeMNode,
org.dataone.service.types.v2.NodeList nodelist)
Compare the session.subject to the authoritativeMN Node.nodeSubjects list of Subjects.
|
protected boolean |
isAuthorizedBySysMetaSubjects(org.dataone.service.types.v1.Session session,
org.dataone.service.types.v2.SystemMetadata sysmeta,
org.dataone.service.types.v1.Permission permission)
Returns the authorization status of the Session vs.
|
protected boolean |
isCNAdmin(org.dataone.service.types.v1.Session session,
org.dataone.service.types.v2.NodeList nodelist)
compares session.subject against CN.NodeList
|
boolean |
isLocalCNAdmin(org.dataone.service.types.v1.Session session)
Test if the user identified by the provided token has administrative authorization
on this node because they are calling themselves
(the implementation uses property Settings to build a Node instance)
|
boolean |
isLocalMNAdmin(org.dataone.service.types.v1.Session session)
Test if the user identified by the provided token has administrative authorization
on this node because they are calling themselves
(the implementation uses property Settings to build a Node instance)
|
protected boolean |
isLocalNodeAdmin(org.dataone.service.types.v1.Session session,
org.dataone.service.types.v1.NodeType nodeType)
Checks Metacat properties representing the local Node document for
matching Node.subjects.
|
protected boolean |
isReplicaMNodeAdmin(org.dataone.service.types.v1.Session session,
org.dataone.service.types.v2.SystemMetadata sysmeta,
org.dataone.service.types.v2.NodeList nodelist)
determines if the session represents a replicaMN of the given systemMetadata.
|
protected void |
prepareAndThrowNotAuthorized(org.dataone.service.types.v1.Session session,
org.dataone.service.types.v1.Identifier pid,
org.dataone.service.types.v1.Permission permission,
java.lang.String detailCode) |
public D1AuthHelper(javax.servlet.http.HttpServletRequest request, org.dataone.service.types.v1.Identifier requestIdentifier, java.lang.String notAuthorizedCode, java.lang.String serviceFailureCode)
request
- hzSystemMetadataMap
- public void doIsAuthorized(org.dataone.service.types.v1.Session session, org.dataone.service.types.v2.SystemMetadata sysmeta, org.dataone.service.types.v1.Permission permission) throws org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized
session
- sysmeta
- permission
- org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
public void doAuthoritativeMNAuthorization(org.dataone.service.types.v1.Session session, org.dataone.service.types.v2.SystemMetadata sysmeta) throws org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized
session
- sysmeta
- org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
public void doUpdateAuth(org.dataone.service.types.v1.Session session, org.dataone.service.types.v2.SystemMetadata sysmeta, org.dataone.service.types.v1.Permission permission, org.dataone.service.types.v1.NodeReference localNodeId) throws org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.ServiceFailure
public void doCNOnlyAuthorization(org.dataone.service.types.v1.Session session) throws org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized
session
- org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
public void doAdminAuthorization(org.dataone.service.types.v1.Session session) throws org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized
session
- org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
public void doGetSysmetaAuthorization(org.dataone.service.types.v1.Session session, org.dataone.service.types.v2.SystemMetadata sysmeta, org.dataone.service.types.v1.Permission permission) throws org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized
session
- sysmeta
- permission
- org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
protected void prepareAndThrowNotAuthorized(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid, org.dataone.service.types.v1.Permission permission, java.lang.String detailCode) throws org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.NotAuthorized
protected boolean checkExpandedPermissions(org.dataone.service.types.v1.Session session, org.dataone.service.types.v2.SystemMetadata sysmeta, org.dataone.service.types.v1.Permission permission) throws org.dataone.service.exceptions.ServiceFailure
sessionSubjects
- sysmeta
- permission
- org.dataone.service.exceptions.ServiceFailure
protected org.dataone.service.types.v2.NodeList getCNNodeList() throws org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotImplemented
public static boolean expandRightsHolder(org.dataone.service.types.v1.Subject rightHolder, org.dataone.service.types.v1.Subject sessionSubject) throws org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.InvalidToken
rightHolder
- the subject of the right holder.sessionSubject
- the subject will be comparedorg.dataone.service.exceptions.NotImplemented
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.InvalidToken
org.dataone.service.exceptions.InvalidRequest
public boolean isLocalMNAdmin(org.dataone.service.types.v1.Session session) throws org.dataone.service.exceptions.ServiceFailure
session
- - the Session object containing the credentials for the Subjectorg.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotImplemented
public boolean isLocalCNAdmin(org.dataone.service.types.v1.Session session) throws org.dataone.service.exceptions.ServiceFailure
session
- - the Session object containing the credentials for the Subjectorg.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotImplemented
protected boolean isLocalNodeAdmin(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.NodeType nodeType) throws org.dataone.service.exceptions.ServiceFailure
session
- nodeType
- org.dataone.service.exceptions.ServiceFailure
protected boolean isAuthorizedBySysMetaSubjects(org.dataone.service.types.v1.Session session, org.dataone.service.types.v2.SystemMetadata sysmeta, org.dataone.service.types.v1.Permission permission)
session
- sysmeta
- permission
- protected boolean isReplicaMNodeAdmin(org.dataone.service.types.v1.Session session, org.dataone.service.types.v2.SystemMetadata sysmeta, org.dataone.service.types.v2.NodeList nodelist)
session
- - the session, uses only the session.subject fieldsysmeta
- nodelist
- protected boolean isAuthoritativeMNodeAdmin(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.NodeReference authoritativeMNode, org.dataone.service.types.v2.NodeList nodelist)
session
- authoritativeMNode
- nodelist
- protected boolean isCNAdmin(org.dataone.service.types.v1.Session session, org.dataone.service.types.v2.NodeList nodelist)
session
- nodelist
- Copyright © 2020 Regents of the University of California. All Rights Reserved.