Package org.exoplatform.caldav.client
Class BlueMindAclClient
java.lang.Object
org.exoplatform.caldav.client.BlueMindAclClient
Reads the access control list of a BlueMind calendar through BlueMind's own
REST API — the one place its sharing state can be read (EXO-90253).
BlueMind's DAV server answers a CS:share with 200 whatever it did
and publishes no sharee list over DAV (CS:invite is a stub:
plugins/net.bluemind.dav.server/.../proto/props/calendarserver/Invite.java),
so the only proof that a grant was applied is the container's access list,
GET /api/containers/_manage/{containerUid}/_acl
(parent/core/net.bluemind.core.container.api/.../IContainerManagement.java),
which the container's owner may read
(ContainerPermissionResolver.java: the owner holds every verb).
The conversation, and what keeps it safe:
- Same server, never another. The REST root is the scheme, host
and port of the endpoint minted from the server registry for the DAV calls,
with the
/apiroot BlueMind serves its REST API under (RestServiceApiDescriptionParser.javaprefixes every path with/api;bluemind-vhosts.confproxieslocation /api/). Nothing a caller passes can name a host; redirects are never followed. - The owner's own credentials, from storage. The login and password are the ones the configured credentials provider produces for the owner's DAV requests, taken from its Basic header; a provider producing anything else is not a login this API accepts, and sharing is not offered.
- A session for one read.
POST /api/auth/login?login=…with the password as a JSON string,Content-Type: application/json— what BlueMind's own client proxy sends (ClientProxyGenerator.java,ByMimeTypeCodec.encode); BlueMind picks the body codec by the exactContent-Typevalue (DefaultBodyParameterCodecs.java), so atext/plaincarrying a charset parameter would be read as JSON, refused with a 500 and logged by BlueMind with the password in it — answers aLoginResponsewhoseauthKeytravels in theX-BM-ApiKeyheader (parent/core/net.bluemind.core.rest/.../base/RestRootHandler.javareads it,BasicClientProxy.javasends it); the key is used for the read andPOST /api/auth/logoutis always sent after it. The key and the password are never logged, never stored, and never part of an exception message. A grant or a revoke, which reads the list before and after its change, holds one suchBlueMindAclClient.Sessionfor both reads (open(org.exoplatform.caldav.client.CalDavEndpoint)) rather than authenticating once per read: half the logins per action, and half the replays of the password against a server whose account lock-out policy eXo does not know.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordOne entry of a BlueMind container's access list.classOne authenticated conversation with BlueMind's REST API. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe header BlueMind's REST API reads a session key from. -
Constructor Summary
ConstructorsConstructorDescriptionBlueMindAclClient(CaldavCredentialsResolver caldavCredentialsResolver) The client Spring builds: no redirects, bounded timeouts. -
Method Summary
Modifier and TypeMethodDescriptionbooleanacceptsCredentials(CalDavEndpoint endpoint) Whether the owner's configured credentials are a login and password this API can take, without calling the server: what decides whether sharing on BlueMind is offered at all, so that a registration whose provider produces a token never shows an action every click of which would be refused.open(CalDavEndpoint endpoint) Opens a REST session as the owner, for as many reads as one service call needs;BlueMindAclClient.Session.close()logs it out.readAcl(CalDavEndpoint endpoint, String containerUid) A container's access list, read as its owner in one short REST session.
-
Field Details
-
API_KEY_HEADER
The header BlueMind's REST API reads a session key from.- See Also:
-
-
Constructor Details
-
BlueMindAclClient
The client Spring builds: no redirects, bounded timeouts.- Parameters:
caldavCredentialsResolver- the seam producing the owner's credentials
-
-
Method Details
-
readAcl
A container's access list, read as its owner in one short REST session.- Parameters:
endpoint- the owner's DAV endpoint, minted from the registrycontainerUid- the container uid, the last segment of the calendar collection's path- Returns:
- the entries, in the order BlueMind lists them
- Throws:
UnsupportedOperationException- when the configured credentials are not a login and passwordCalDavAuthenticationException- when BlueMind refuses the loginCalDavForbiddenException- when the account may not read the listCalDavUnreachableException- when the server cannot be reachedCalDavException- when the answer is anything else
-
open
Opens a REST session as the owner, for as many reads as one service call needs;BlueMindAclClient.Session.close()logs it out. The exceptions are those ofreadAcl(CalDavEndpoint, String)for the login half.- Parameters:
endpoint- the owner's DAV endpoint, minted from the registry- Returns:
- the session, to close
-
acceptsCredentials
Whether the owner's configured credentials are a login and password this API can take, without calling the server: what decides whether sharing on BlueMind is offered at all, so that a registration whose provider produces a token never shows an action every click of which would be refused.- Parameters:
endpoint- the owner's endpoint, minted from the registry- Returns:
- true when the provider produces a Basic login and password
-