Method: Crowd.authenticate_principal
- Defined in:
- lib/crowd.rb
.authenticate_principal(username, password) ⇒ Object
Authenticate principal
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/crowd.rb', line 88 def self.authenticate_principal(username, password) response = authenticated_connection do pword = PasswordCredential.new(password, false) ctx = PrincipalAuthenticationContext.new(@@application_token.name, pword, username, nil) arg = AuthenticatePrincipal.new(@@application_token, ctx) server.authenticatePrincipal(arg) end #evaluate the response. ideally, the authenticatePrincipal call should #return an AuthenticationInvalidCredentialException and we can handle it more #nicely below. case response when AuthenticatePrincipalResponse return response.out when InvalidAuthenticationException return nil when nil #no reponse raise AuthenticationInvalidCredentialException, response else raise AuthenticationException, response end end |