org.wso2.carbon.device.mgt.mobile.windows.api.common.util

## Class UsernameTokenValidator

- java.lang.Object
- - org.wso2.carbon.device.mgt.mobile.windows.api.common.util.UsernameTokenValidator

- All Implemented Interfaces:
    org.apache.ws.security.validate.Validator

      public class UsernameTokenValidator
      extends Object
      implements org.apache.ws.security.validate.Validator

  Validator class for user authentication checking the default carbon user store.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `UsernameTokenValidator()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `authenticate(String username, String password, String tenantDomain)` This method authenticate the user checking the carbon default user store.
    `org.apache.ws.security.validate.Credential` | `validate(org.apache.ws.security.validate.Credential credential, org.apache.ws.security.handler.RequestData requestData)` This method validates the username token in SOAP message coming from the device.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### UsernameTokenValidator

          public UsernameTokenValidator()

  - ### Method Detail

    - #### validate

          public org.apache.ws.security.validate.Credential validate(org.apache.ws.security.validate.Credential credential,
                                                            org.apache.ws.security.handler.RequestData requestData)
                                                              throws org.apache.ws.security.WSSecurityException

      This method validates the username token in SOAP message coming from the device.
      Specified by:
        `validate` in interface `org.apache.ws.security.validate.Validator`
      Parameters:
        `credential` - - Username token credentials coming from device
        `requestData` - - Request data associated with the request
      Returns:
        - Credential object if authentication is success, or null if not success
      Throws:
        `org.apache.ws.security.WSSecurityException`

    - #### authenticate

          public boolean authenticate(String username,
                             String password,
                             String tenantDomain)
                               throws AuthenticationException

      This method authenticate the user checking the carbon default user store.
      Parameters:
        `username` - - Username in username token
        `password` - - Password in username token
        `tenantDomain` - - Tenant domain is extracted from the username
      Returns:
        - Returns boolean representing authentication result
      Throws:
        `AuthenticationException`

Copyright © 2017 WSO2. All rights reserved.