Class: OpenTox::Authorization::AA
- Inherits:
-
Object
- Object
- OpenTox::Authorization::AA
- Defined in:
- lib/authorization.rb
Overview
Helper Class AA to create and send default policies out of xml templates
Instance Attribute Summary collapse
-
#policy ⇒ Object
Returns the value of attribute policy.
-
#subjectid ⇒ Object
Returns the value of attribute subjectid.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
-
#get_xml(uri) ⇒ Object
Cleans AA Policies and loads default xml file into policy attribute set uri and user, returns Policyfile(XML) for open-sso.
-
#initialize(subjectid) ⇒ AA
constructor
Generates AA object - requires subjectid.
-
#send(uri) ⇒ Object
Loads and sends Policyfile(XML) to open-sso server.
Constructor Details
#initialize(subjectid) ⇒ AA
Generates AA object - requires subjectid
23 24 25 26 27 |
# File 'lib/authorization.rb', line 23 def initialize(subjectid) @user = Authorization.get_user(subjectid) @subjectid = subjectid @policy = Policies.new() end |
Instance Attribute Details
#policy ⇒ Object
Returns the value of attribute policy.
19 20 21 |
# File 'lib/authorization.rb', line 19 def policy @policy end |
#subjectid ⇒ Object
Returns the value of attribute subjectid.
19 20 21 |
# File 'lib/authorization.rb', line 19 def subjectid @subjectid end |
#user ⇒ Object
Returns the value of attribute user.
19 20 21 |
# File 'lib/authorization.rb', line 19 def user @user end |
Instance Method Details
#get_xml(uri) ⇒ Object
Cleans AA Policies and loads default xml file into policy attribute set uri and user, returns Policyfile(XML) for open-sso
32 33 34 35 36 |
# File 'lib/authorization.rb', line 32 def get_xml(uri) @policy.drop_policies @policy.load_default_policy(@user, uri) return @policy.to_xml end |
#send(uri) ⇒ Object
Loads and sends Policyfile(XML) to open-sso server
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/authorization.rb', line 40 def send(uri) xml = get_xml(uri) ret = false ret = Authorization.create_policy(xml, @subjectid) LOGGER.warn "Create policy on openSSO failed for URI: #{uri} subjectid: #{@subjectid}. Will try again." if !ret ret = Authorization.create_policy(xml, @subjectid) if !ret LOGGER.debug "Policy send with subjectid: #{@subjectid}" LOGGER.warn "Not created Policy is: #{xml}" if !ret ret end |