Diffusion Apple API 6.12.0
Unified Client Library for iOS, tvOS and OS X / macOS
Loading...
Searching...
No Matches
Instance Methods | List of all members
PTDiffusionSecurityFeature Class Reference

Introduction

This feature provides a client session with the ability to change its associated principal as well as to query permissions assigned to it.

The Security feature for a session can be obtained from the session's security property.

See also
PTDiffusionSession
Since
5.6
Inheritance diagram for PTDiffusionSecurityFeature:
PTDiffusionFeature

Instance Methods

(void) - changePrincipal:credentials:completionHandler:
 
(bool) - reauthenticate:credentials:sessionProperties:completionHandler:error:
 
(void) - getGlobalPermissionsWithCompletionHandler:
 
(void) - getTopicPermissionsForPath:completionHandler:
 

Additional Inherited Members

- Properties inherited from PTDiffusionFeature
PTDiffusionSessionsession
 

Method Documentation

◆ changePrincipal:credentials:completionHandler:

- (void) changePrincipal: (nullable NSString *)  principal
credentials: (nullable PTDiffusionCredentials *)  credentials
completionHandler: (void(^)(NSError *_Nullable error))  completionHandler 

Change the security principal associated with the current session.

If authentication fails, the current principal will remain valid.

Parameters
principalThe new principal name.
credentialsThe credentials authenticating the new principal.
completionHandlerBlock to be called asynchronously on success or failure. If the operation was successful, the error argument passed to the block will be nil. The completion handler will be called asynchronously on the main dispatch queue.
Exceptions
NSInvalidArgumentExceptionRaised if the completionHandler argument is nil.
Since
5.6

◆ getGlobalPermissionsWithCompletionHandler:

- (void) getGlobalPermissionsWithCompletionHandler: (void(^)(NSSet< PTDiffusionGlobalPermission * > *_Nullable permissions, NSError *_Nullable error))  completionHandler

Query the global permissions assigned to the calling session.

Parameters
completionHandlerBlock to be called asynchronously on success or failure. If the operation was successful, the error argument passed to the block will be nil. The completion handler will be called asynchronously on the main dispatch queue.
Since
6.3

◆ getTopicPermissionsForPath:completionHandler:

- (void) getTopicPermissionsForPath: (NSString *)  path
completionHandler: (void(^)(NSSet< PTDiffusionPathPermission * > *_Nullable permissions, NSError *_Nullable error))  completionHandler 

Query the topic permissions assigned to the calling session on a given path.

Parameters
paththe path to query for permissions
completionHandlerBlock to be called asynchronously on success or failure. If the operation was successful, the error argument passed to the block will be nil. The completion handler will be called asynchronously on the main dispatch queue.
Since
6.3

◆ reauthenticate:credentials:sessionProperties:completionHandler:error:

- (bool) reauthenticate: (nullable NSString *)  principal
credentials: (nullable PTDiffusionCredentials *)  credentials
sessionProperties: (nullable NSDictionary< NSString *, NSString * > *)  sessionProperties
completionHandler: (void(^)(BOOL success, NSError *_Nullable error))  completionHandler
error: (NSError *__autoreleasing *const)  error 

Re-authenticate the session.

This may be used to change the principal for the session, or to re-authenticate the session before it expires.

A session may determine when it is due to expire by querying the value of the $ExpiryTime session property using PTDiffusionSession#getSessionProperties.

If this property is not present the session will not expire and there is no need to re-authenticate unless the principal in use is to be changed.

Parameters
principalThe new principal name.
credentialsThe credentials authenticating the new principal.
sesssionPropertiesThe user-defined session properties.
completionHandlerBlock to be called asynchronously on success or failure. If the operation was successful, the error argument passed to the block will be nil. The completion handler will be called asynchronously on the main dispatch queue.
errorIf this method returns NO to indicate that an error occurred then this will be populated with the reason for that failure.
Returns
YES on success; or NO if an error occurred, in which case *error will be populated with the failure reason.
Since
6.12