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
-
tokenThe HPCSToken object representing the user’s credentials.
property -
tenantThe HPCSTenant object representing the the current user’s tenant.
property -
serviceCatalogThe NSArray of NSDictionary objects which represent services the current user can see.
property -
isTokenValidWhether or not the current token is valid
property -
accessKeyIdThe access key for this user
property -
secretKeyThe access key for this user
property
Creating and Initializing HPCSIdentity Clients
-
+ sharedClientConvenience method to get the HPCSIdentityClient
-
– initWithUsername:andPassword:andTenantId: -
– initWithAccessKeyId:andSecretKey:andTenantId:Initialize using accessKey and secret key
-
– authorizationInfoNSDictionary 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
-
– isTokenExpiredWhether or not your HPCSToken is expired
-
– isAuthenticatedWhether or not you are logged in
Ending Your Session
-
– tokenInvalidate:failure:Invalidate your current token
Getting Access To Authenticated Services
-
– computeClientRetrieve an instance of the Compute Client,designated way to get an instance of the Compute (Nova) client
-
– publicUrlForComputethe URL for the compute endpoint as listed in the Service Catalog
-
– swiftClientRetrieve an instance of the Object Storage Client, designated way to get an instance of the object storage (Swift) client
-
– publicUrlForObjectStoragethe URL for the object storage endpoint as listed in the Service Catalog
-
– cdnClientRetrieve an instance of the Object Storage Client, designated way to get an instance of the object storage (Swift) client
-
– publicUrlForCDNthe 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
-
– usernameGet the stored username
-
– setPassword:Storage password in the secure Keychain
-
– passwordGet the password from the secure Keychain
-
– setTenantId:Store the tenantId in the secure Keychain
-
– tenantIdGet the tenantId from storage
-
– tokenGet the token from the Keychain
-
– setToken:Store the token in the secure Keychain
Properties
accessKeyId
The access key for this user
@property (retain) NSString *accessKeyIdDiscussion
will be nil if sharedClient is utilized for intitialization
Declared In
HPCSIdentityClient.hisTokenValid
Whether or not the current token is valid
@property (assign) BOOL isTokenValidDeclared In
HPCSIdentityClient.hsecretKey
The access key for this user
@property (retain) NSString *secretKeyDiscussion
will be nil if sharedClient is utilized for intitialization
Declared In
HPCSIdentityClient.hserviceCatalog
The NSArray of NSDictionary objects which represent services the current user can see.
@property (retain) NSArray *serviceCatalogDeclared In
HPCSIdentityClient.htenant
The HPCSTenant object representing the the current user’s tenant.
@property (retain) HPCSTenant *tenantDeclared In
HPCSIdentityClient.htoken
The HPCSToken object representing the user’s credentials.
@property (retain) HPCSToken *tokenDeclared In
HPCSIdentityClient.hClass Methods
sharedClient
Convenience method to get the HPCSIdentityClient
+ (HPCSIdentityClient *)sharedClientDiscussion
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.hInstance 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 ))failureParameters
- 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.hauthorizationInfo
NSDictionary which holds either username/password type information or accessKey/secretKey type of information
- (NSDictionary *)authorizationInfoDeclared In
HPCSIdentityClient.hcdnClient
Retrieve an instance of the Object Storage Client, designated way to get an instance of the object storage (Swift) client
- (HPCSCDNClient *)cdnClientDiscussion
if the service catalog does not contain a compute service for this user the HPCSKeystoneSwiftCatalogIsEmptyNotification is sent.
Declared In
HPCSIdentityClient.hcomputeClient
Retrieve an instance of the Compute Client,designated way to get an instance of the Compute (Nova) client
- (HPCSComputeClient *)computeClientReturn 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.hinitWithAccessKeyId:andSecretKey:andTenantId:
Initialize using accessKey and secret key
- (id)initWithAccessKeyId:(NSString *)accessKey andSecretKey:(NSString *)secretKey andTenantId:(NSString *)tenantIdParameters
- 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.hinitWithUsername:andPassword:andTenantId:
- (id)initWithUsername:(NSString *)userName andPassword:(NSString *)password andTenantId:(NSString *)tenantIdParameters
- 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.hisAuthenticated
Whether or not you are logged in
- (BOOL)isAuthenticatedDeclared In
HPCSIdentityClient.hisTokenExpired
Whether or not your HPCSToken is expired
- (BOOL)isTokenExpiredDeclared In
HPCSIdentityClient.hpassword
Get the password from the secure Keychain
- (NSString *)passwordDeclared In
HPCSIdentityClient.hpublicUrlForCDN
the URL for the object storage endpoint as listed in the Service Catalog
- (NSString *)publicUrlForCDNDeclared In
HPCSIdentityClient.hpublicUrlForCompute
the URL for the compute endpoint as listed in the Service Catalog
- (NSString *)publicUrlForComputeDeclared In
HPCSIdentityClient.hpublicUrlForObjectStorage
the URL for the object storage endpoint as listed in the Service Catalog
- (NSString *)publicUrlForObjectStorageDeclared In
HPCSIdentityClient.hsetPassword:
Storage password in the secure Keychain
- (void)setPassword:(NSString *)passwordParameters
- password
the password to set
Discussion
pass in nil to delete from Keychain
Declared In
HPCSIdentityClient.hsetTenantId:
Store the tenantId in the secure Keychain
- (void)setTenantId:(NSString *)tenantIdParameters
- tenantId
the tenantId to store
Declared In
HPCSIdentityClient.hsetToken:
Store the token in the secure Keychain
- (void)setToken:(HPCSToken *)tokenParameters
- 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.hsetUsername:
Stores the user name in the secure Keychain
- (void)setUsername:(NSString *)userNameParameters
- userName
your username
Declared In
HPCSIdentityClient.hswiftClient
Retrieve an instance of the Object Storage Client, designated way to get an instance of the object storage (Swift) client
- (HPCSSwiftClient *)swiftClientDiscussion
if the service catalog does not contain a compute service for this user the HPCSKeystoneSwiftCatalogIsEmptyNotification is sent.
Declared In
HPCSIdentityClient.htokenInvalidate:failure:
Invalidate your current token
- (void)tokenInvalidate:(void ( ^ ) ( NSHTTPURLResponse *response ))success failure:(void ( ^ ) ( NSHTTPURLResponse *response , NSError *error ))failureParameters
- 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