Class: RubyAem::Resources::AuthorizableKeystore

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_aem/resources/authorizable_keystore.rb

Overview

AEM class contains API calls related to managing the AEM Authorizable Keystore.

Instance Method Summary collapse

Constructor Details

#initialize(client, intermediate_path, authorizable_id) ⇒ Object

Initialise an Authorizable Keystore

Parameters:

  • client

    RubyAem::Client

  • intermediate_path

    AEM User home path

  • authorizable_id

    AEM User id



30
31
32
33
34
35
36
# File 'lib/ruby_aem/resources/authorizable_keystore.rb', line 30

def initialize(client, intermediate_path, authorizable_id)
  @client = client
  @call_params = {
    intermediate_path: intermediate_path,
    authorizable_id: authorizable_id
  }
end

Instance Method Details

#change_password(old_password, new_password) ⇒ Object

Returns RubyAem::Result.

Returns:

  • RubyAem::Result



53
54
55
56
57
# File 'lib/ruby_aem/resources/authorizable_keystore.rb', line 53

def change_password(old_password, new_password)
  @call_params[:old_password] = old_password
  @call_params[:new_password] = new_password
  @client.call(self.class, __callee__.to_s, @call_params)
end

#create(password) ⇒ Object

Create AEM Authorizable Keystore.

Parameters:

  • password

    Password for the keystore

Returns:

  • RubyAem::Result



42
43
44
45
# File 'lib/ruby_aem/resources/authorizable_keystore.rb', line 42

def create(password)
  @call_params[:password] = password
  @client.call(self.class, __callee__.to_s, @call_params)
end

#deleteObject

Delete AEM Authorizable Keystore

Returns:

  • RubyAem::Result



83
84
85
# File 'lib/ruby_aem/resources/authorizable_keystore.rb', line 83

def delete
  @client.call(self.class, __callee__.to_s, @call_params)
end

#download(file_path) ⇒ Object

Download the AEM Keystore to a specified directory.

Parameters:

  • file_path

    the directory where the Keystore will be downloaded to

Returns:

  • RubyAem::Result



73
74
75
76
77
78
# File 'lib/ruby_aem/resources/authorizable_keystore.rb', line 73

def download(
  file_path
)
  @call_params[:file_path] = file_path
  @client.call(self.class, __callee__.to_s, @call_params)
end

#existsObject

Check if a keystore for the given authorizable id already exists.

Returns:

  • RubyAem::Result



90
91
92
# File 'lib/ruby_aem/resources/authorizable_keystore.rb', line 90

def exists
  @client.call(self.class, __callee__.to_s, @call_params)
end

#infoObject

Retrieve AEM Authorizable Keystore info.

Returns:

  • RubyAem::Result



97
98
99
# File 'lib/ruby_aem/resources/authorizable_keystore.rb', line 97

def info
  @client.call(self.class, __callee__.to_s, @call_params)
end

#read(file_path, password) ⇒ Object

Read an authorizable keystore in PKCS#12 Format

Parameters:

  • file_path

    local file path to Keystore PKCS12 file

  • password

    Password of the Keystore PKCS12 File

Returns:

  • OpenSSL::PKCS12



64
65
66
67
# File 'lib/ruby_aem/resources/authorizable_keystore.rb', line 64

def read(file_path, password)
  authorizable_keystore_raw = File.read file_path
  OpenSSL::PKCS12.new(authorizable_keystore_raw, password)
end