Esempio n. 1
0
  /**
   * Returns an AuthToken from the account object. Should never return null.
   *
   * @param acct
   * @param isAdmin
   * @param authMech
   * @return
   * @throws AuthProviderException
   */
  protected AuthToken authToken(Account acct, boolean isAdmin, AuthMech authMech)
      throws AuthProviderException {
    if (acct == null) {
      throw AuthProviderException.NOT_SUPPORTED();
    }

    long lifetime =
        isAdmin
            ? acct.getTimeInterval(
                Provisioning.A_zimbraAdminAuthTokenLifetime, AuthToken.DEFAULT_AUTH_LIFETIME * 1000)
            : acct.getTimeInterval(
                Provisioning.A_zimbraAuthTokenLifetime, AuthToken.DEFAULT_AUTH_LIFETIME * 1000);
    return authToken(acct, lifetime);
  }
Esempio n. 2
0
 /**
  * Returns an AuthToken from the account object with specified expiration. Should never return
  * null.
  *
  * @param acct
  * @param expires
  * @param isAdmin
  * @param adminAcct
  * @param acct account authtoken will be valid for
  * @param expires when the token expires
  * @param isAdmin true if acct is using its admin privileges
  * @param adminAcct the admin account accessing acct's information, if this token was created by
  *     an admin.
  * @return
  * @throws AuthProviderException
  */
 protected AuthToken authToken(Account acct, long expires, boolean isAdmin, Account adminAcct)
     throws AuthProviderException {
   throw AuthProviderException.NOT_SUPPORTED();
 }
Esempio n. 3
0
 /**
  * Returns an AuthToken from the account object with specified lifetime. Should never return null.
  *
  * @param acct
  * @param expires
  * @return
  * @throws AuthProviderException
  */
 protected AuthToken authToken(Account acct, long expires) throws AuthProviderException {
   throw AuthProviderException.NOT_SUPPORTED();
 }
Esempio n. 4
0
 /**
  * Returns an AuthToken from an encoded String.
  *
  * <p>This API is for servlets that support auth from a non-cookie channel, where it honors a
  * String token from a specific element in the request, which is neither a cookie nor a SOAP
  * context header. e.g. a query param.
  *
  * <p>By default, an AuthProvider do not need to implement this method. The default implementation
  * is throwing AuthProviderException.NOT_SUPPORTED.
  *
  * <p>Should never return null. Throws AuthProviderException.NO_SUPPORTED if this API is not
  * supported by the auth provider Throws AuthProviderException.NO_AUTH_TOKEN if auth data for the
  * provider is not present Throws AuthTokenException if auth data for the provider is present but
  * cannot be resolved into a valid AuthToken
  *
  * @param encoded
  * @return
  * @throws AuthProviderException
  * @throws AuthTokenException
  */
 protected AuthToken authToken(String encoded) throws AuthProviderException, AuthTokenException {
   throw AuthProviderException.NOT_SUPPORTED();
 }