Class: TokenService::TokenService
- Inherits:
-
BasicService
- Object
- Handsoap::Service
- BasicService
- TokenService::TokenService
- Defined in:
- lib/token_service/token_service.rb
Overview
TokenService client to perform authentication against the security token service. Authentication is performed in two steps:
-
Call
login
to gather an intermediate token -
Call
getTokens
to gather one or more security token(s). -
Call any service method passing the security token(s) along the soap header.
The security token service is an implementation of the OASIS WSS specification. See also: www.oasis-open.org/committees/wss/.
Be aware that all security information is provided in the soap header not in the soap body. This is why a wss enabled service does not provide a separate method parameter to pass the security tokens. As mentioned before security is passed in the soap header, instead.
Constant Summary collapse
- @@TOKEN_SERVICE_ENDPOINT =
{ :uri => 'https://sts.idm.telekom.com/TokenService', :version => 1 }
- @@PERFORM_LOCAL_TOKEN_CHECKS =
This is disabled per default because client time and server time need to be in sync to use this function. Otherwise local token verification might fail even on valid tokens. This would imply an unnecessary call to the token service.
false
Instance Method Summary collapse
-
#get_security_token ⇒ Object
Check whether there is a security token.
-
#login ⇒ Object
Call the the security token service to gather an intermediate token.
Methods inherited from BasicService
#initialize, #on_create_document, #on_response_document
Constructor Details
This class inherits a constructor from BasicService
Instance Method Details
#get_security_token ⇒ Object
Check whether there is a security token. Authenticate if not. Reauthenticates if the security token has expired.
Returns
Security token as plain text/xml.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/token_service/token_service.rb', line 66 def get_security_token # Reauthenticates if the security token has expired. if @security_token.nil? then authenticate end # Look at the validity dates of the token and locally check whether the token is still valid. if @@PERFORM_LOCAL_TOKEN_CHECKS && SecurityTokenValidator.token_invalid?(@security_token) then authenticate end return @security_token end |
#login ⇒ Object
Call the the security token service to gather an intermediate token.
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/token_service/token_service.rb', line 47 def login response = invoke("login") do || doc = .document # Build the login header build_login_header(doc) end intermediate_token = parse_token_data(response) return intermediate_token end |