HPCSIdentityClient Class Reference
Inherits from | AFHTTPClient |
Declared in | HPCSIdentityClient.h |
Overview
Allows Access to the HP Cloud Services authorization system (Control Services).
this classes listens for the notification HPCSKeystoneCredentialsDidChangeNotification so that it can dump the current cached token. Use this to force the token to be dumped *
Tasks
Other Methods
-
token
The HPCSToken object representing the user’s credentials.
property -
tenant
The HPCSTenant object representing the the current user’s tenant.
property -
serviceCatalog
The NSArray of NSDictionary objects which represent services the current user can see.
property -
isTokenValid
Whether or not the current token is valid
property -
accessKeyId
The access key for this user
property -
secretKey
The access key for this user
property
Creating and Initializing HPCSIdentity Clients
-
+ sharedClient
Convenience method to get the HPCSIdentityClient
-
– initWithUsername:andPassword:andTenantId:
-
– initWithAccessKeyId:andSecretKey:andTenantId:
Initialize using accessKey and secret key
-
– authorizationInfo
NSDictionary which holds either username/password type information or accessKey/secretKey type of information
Authenticating with Control Services (Keystone)
-
– authenticate:failure:
Authenticate to HP Cloud Services Identity Services and return security token
Checking Your Authorization Status
-
– isTokenExpired
Whether or not your HPCSToken is expired
-
– isAuthenticated
Whether or not you are logged in
Ending Your Session
-
– tokenInvalidate:failure:
Invalidate your current token
Getting Access To Authenticated Services
-
– computeClient
Retrieve an instance of the Compute Client,designated way to get an instance of the Compute (Nova) client
-
– publicUrlForCompute
the URL for the compute endpoint as listed in the Service Catalog
-
– swiftClient
Retrieve an instance of the Object Storage Client, designated way to get an instance of the object storage (Swift) client
-
– publicUrlForObjectStorage
the URL for the object storage endpoint as listed in the Service Catalog
-
– cdnClient
Retrieve an instance of the Object Storage Client, designated way to get an instance of the object storage (Swift) client
-
– publicUrlForCDN
the URL for the object storage endpoint as listed in the Service Catalog
Secure Management of Your Credentials
-
– setUsername:
Stores the user name in the secure Keychain
-
– username
Get the stored username
-
– setPassword:
Storage password in the secure Keychain
-
– password
Get the password from the secure Keychain
-
– setTenantId:
Store the tenantId in the secure Keychain
-
– tenantId
Get the tenantId from storage
-
– token
Get the token from the Keychain
-
– setToken:
Store the token in the secure Keychain
Properties
accessKeyId
The access key for this user
@property (retain) NSString *accessKeyId
Discussion
will be nil if sharedClient is utilized for intitialization
Declared In
HPCSIdentityClient.h
isTokenValid
Whether or not the current token is valid
@property (assign) BOOL isTokenValid
Declared In
HPCSIdentityClient.h
secretKey
The access key for this user
@property (retain) NSString *secretKey
Discussion
will be nil if sharedClient is utilized for intitialization
Declared In
HPCSIdentityClient.h
serviceCatalog
The NSArray of NSDictionary objects which represent services the current user can see.
@property (retain) NSArray *serviceCatalog
Declared In
HPCSIdentityClient.h
tenant
The HPCSTenant object representing the the current user’s tenant.
@property (retain) HPCSTenant *tenant
Declared In
HPCSIdentityClient.h
token
The HPCSToken object representing the user’s credentials.
@property (retain) HPCSToken *token
Declared In
HPCSIdentityClient.h
Class Methods
sharedClient
Convenience method to get the HPCSIdentityClient
+ (HPCSIdentityClient *)sharedClient
Discussion
This is the designated initializer. Returns a singleton. If you use this method, then you are using the initWithUsername:andPassword:andTenantId: method to constuct the identity client instance, as opposed to the initWithAccessKeyId:andSecretKey:andTenantId: method.
Declared In
HPCSIdentityClient.h
Instance Methods
authenticate:failure:
Authenticate to HP Cloud Services Identity Services and return security token
- (void)authenticate:(void ( ^ ) ( NSArray *serviceCatalog ))block failure:(void ( ^ ) ( NSHTTPURLResponse *responseObject , NSError *error ))failure
Parameters
- block
a block which returns an NSArray of NSDictionary objects representing services available to you such as Compute, or Object Storage
- failure
the block called if the authenticate method failed
Discussion
if the service catalog is empty, then your credentials where not valid. You can subscribe to HPCSAuthenticationDidFailNotification to take appropriate action if the credentials are bad
Declared In
HPCSIdentityClient.h
authorizationInfo
NSDictionary which holds either username/password type information or accessKey/secretKey type of information
- (NSDictionary *)authorizationInfo
Declared In
HPCSIdentityClient.h
cdnClient
Retrieve an instance of the Object Storage Client, designated way to get an instance of the object storage (Swift) client
- (HPCSCDNClient *)cdnClient
Discussion
if the service catalog does not contain a compute service for this user the HPCSKeystoneSwiftCatalogIsEmptyNotification is sent.
Declared In
HPCSIdentityClient.h
computeClient
Retrieve an instance of the Compute Client,designated way to get an instance of the Compute (Nova) client
- (HPCSComputeClient *)computeClient
Return Value
nil if no compute resource is in the service catalog
Discussion
if the service catalog does not contain a compute service for this user the HPCSKeystoneNovaCatalogIsEmptyNotification is sent
Normal Response Code(s): 204
Error Response Code(s): unauthorized (401), forbidden (403), badRequest (400))
Declared In
HPCSIdentityClient.h
initWithAccessKeyId:andSecretKey:andTenantId:
Initialize using accessKey and secret key
- (id)initWithAccessKeyId:(NSString *)accessKey andSecretKey:(NSString *)secretKey andTenantId:(NSString *)tenantId
Parameters
- accessKey
Your access key
- secretKey
Your secret key
- tenantId
Your tenantId for your account
Discussion
HP Cloud Services allows either AccessKey and SecretKey based login or username and password based login.
Declared In
HPCSIdentityClient.h
initWithUsername:andPassword:andTenantId:
- (id)initWithUsername:(NSString *)userName andPassword:(NSString *)password andTenantId:(NSString *)tenantId
Parameters
- userName
The name that you use to login to the Management Console with
- password
The password that you use to login to the Management Console with
- tenantId
Your tenantId for your account
Discussion
HP Cloud Services allows either AccessKey and SecretKey based login or username and password based login. sharedClient calls this one.
Declared In
HPCSIdentityClient.h
isAuthenticated
Whether or not you are logged in
- (BOOL)isAuthenticated
Declared In
HPCSIdentityClient.h
isTokenExpired
Whether or not your HPCSToken is expired
- (BOOL)isTokenExpired
Declared In
HPCSIdentityClient.h
password
Get the password from the secure Keychain
- (NSString *)password
Declared In
HPCSIdentityClient.h
publicUrlForCDN
the URL for the object storage endpoint as listed in the Service Catalog
- (NSString *)publicUrlForCDN
Declared In
HPCSIdentityClient.h
publicUrlForCompute
the URL for the compute endpoint as listed in the Service Catalog
- (NSString *)publicUrlForCompute
Declared In
HPCSIdentityClient.h
publicUrlForObjectStorage
the URL for the object storage endpoint as listed in the Service Catalog
- (NSString *)publicUrlForObjectStorage
Declared In
HPCSIdentityClient.h
setPassword:
Storage password in the secure Keychain
- (void)setPassword:(NSString *)password
Parameters
- password
the password to set
Discussion
pass in nil to delete from Keychain
Declared In
HPCSIdentityClient.h
setTenantId:
Store the tenantId in the secure Keychain
- (void)setTenantId:(NSString *)tenantId
Parameters
- tenantId
the tenantId to store
Declared In
HPCSIdentityClient.h
setToken:
Store the token in the secure Keychain
- (void)setToken:(HPCSToken *)token
Parameters
- token
the token object to store in the Keychain
Discussion
pass in nil to delete token from Keychain, this will cause a relogin to occur the next time an authenticated service is called. This essentially deletes the local cache of the token.
Declared In
HPCSIdentityClient.h
setUsername:
Stores the user name in the secure Keychain
- (void)setUsername:(NSString *)userName
Parameters
- userName
your username
Declared In
HPCSIdentityClient.h
swiftClient
Retrieve an instance of the Object Storage Client, designated way to get an instance of the object storage (Swift) client
- (HPCSSwiftClient *)swiftClient
Discussion
if the service catalog does not contain a compute service for this user the HPCSKeystoneSwiftCatalogIsEmptyNotification is sent.
Declared In
HPCSIdentityClient.h
tokenInvalidate:failure:
Invalidate your current token
- (void)tokenInvalidate:(void ( ^ ) ( NSHTTPURLResponse *response ))success failure:(void ( ^ ) ( NSHTTPURLResponse *response , NSError *error ))failure
Parameters
- success
block called if this operation succeeds
- failure
block called if this operation fails
Discussion
allows you to manually invalidate your current token/session on the Control Services server, this does not delete the local cached token, and that token will be invalid after the success of this method.
Declared In
HPCSIdentityClient.h