Method: Crowd.authenticate_application
- Defined in:
- lib/crowd.rb
.authenticate_application ⇒ Object
Authenticate application
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/crowd.rb', line 57 def self.authenticate_application() @@application_token = nil if @@crowd_app_name.nil? @@crowd_app_name = CROWD_APPLICATION_NAME end if @@crowd_app_pword.nil? @@crowd_app_pword = CROWD_APPLICATION_PASSWORD end pword = PasswordCredential.new(@@crowd_app_pword, false) ctx = ApplicationAuthenticationContext.new(pword, @@crowd_app_name, nil) arg = AuthenticateApplication.new(ctx) begin response = server.authenticateApplication(arg) rescue Errno::ECONNREFUSED raise AuthenticationConnectionException rescue Exception raise AuthenticationException, response end if !response.is_a?(AuthenticateApplicationResponse) raise AuthenticationException, response end @@application_token = AuthenticatedToken.new(@@crowd_app_name, response.out.token) response.out.token end |