Class GrantAuthorizer
- All Implemented Interfaces:
Authorizer
public class GrantAuthorizer extends Object implements Authorizer
This Authorizer implementation grants permission
for a set of operations defined at construction time.
If the operation does not match, it ignores the authorization request.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.cometd.bayeux.server.Authorizer
Authorizer.Operation, Authorizer.Result -
Field Summary
Fields Modifier and Type Field Description static GrantAuthorizerGRANT_ALLGrantsAuthorizer.Operation.CREATE,Authorizer.Operation.SUBSCRIBEandAuthorizer.Operation.PUBLISHauthorizationstatic GrantAuthorizerGRANT_CREATEGrantsAuthorizer.Operation.CREATEauthorizationstatic GrantAuthorizerGRANT_CREATE_SUBSCRIBEGrantsAuthorizer.Operation.CREATEandAuthorizer.Operation.SUBSCRIBEauthorizationstatic GrantAuthorizerGRANT_NONEGrants no authorization, the authorization request is ignoredstatic GrantAuthorizerGRANT_PUBLISHGrantsAuthorizer.Operation.PUBLISHauthorizationstatic GrantAuthorizerGRANT_SUBSCRIBEGrantsAuthorizer.Operation.SUBSCRIBEauthorizationstatic GrantAuthorizerGRANT_SUBSCRIBE_PUBLISHGrantsAuthorizer.Operation.SUBSCRIBEandAuthorizer.Operation.PUBLISHauthorization -
Method Summary
Modifier and Type Method Description Authorizer.Resultauthorize(Authorizer.Operation operation, ChannelId channel, ServerSession session, ServerMessage message)Callback invoked to authorize the givenoperationon the givenchannel.StringtoString()
-
Field Details
-
GRANT_CREATE
GrantsAuthorizer.Operation.CREATEauthorization -
GRANT_SUBSCRIBE
GrantsAuthorizer.Operation.SUBSCRIBEauthorization -
GRANT_PUBLISH
GrantsAuthorizer.Operation.PUBLISHauthorization -
GRANT_CREATE_SUBSCRIBE
GrantsAuthorizer.Operation.CREATEandAuthorizer.Operation.SUBSCRIBEauthorization -
GRANT_SUBSCRIBE_PUBLISH
GrantsAuthorizer.Operation.SUBSCRIBEandAuthorizer.Operation.PUBLISHauthorization -
GRANT_ALL
GrantsAuthorizer.Operation.CREATE,Authorizer.Operation.SUBSCRIBEandAuthorizer.Operation.PUBLISHauthorization -
GRANT_NONE
Grants no authorization, the authorization request is ignored
-
-
Method Details
-
authorize
public Authorizer.Result authorize(Authorizer.Operation operation, ChannelId channel, ServerSession session, ServerMessage message)Description copied from interface:AuthorizerCallback invoked to authorize the given
operationon the givenchannel.Additional parameters are passed to this method as context parameters, so that it is possible to implement complex logic based on the
ServerSessionandServerMessagethat are requesting the authorization.Note that the message channel is not the same as the
channelIdparameter. For example, for subscription requests, the message channel isChannel.META_SUBSCRIBE, while thechannelIdparameter is the channel for which the subscription is requested.Note that for
create operation, the channel instance does not yet exist: it will be created only after the authorization is granted.- Specified by:
authorizein interfaceAuthorizer- Parameters:
operation- the operation to authorizechannel- the channel for which the authorization has been requestedsession- the session that is requesting the authorizationmessage- the message that triggered the authorization request- Returns:
- the result of the authorization
-
toString
-