All Downloads are FREE. Search and download functionalities are using the official Maven repository.

co.cask.common.security.authentication.TokenState Maven / Gradle / Ivy

There is a newer version: 0.11.0
Show newest version
/*
 * Copyright © 2014 Cask Data, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package co.cask.common.security.authentication;

/**
 * Different states attained after validating the token
 * 
    *
  • MISSING - the access token is missing in the request
  • *
  • INVALID - the token digest did not match the expected value
  • *
  • EXPIRED - the token is past the expiration timestamp
  • *
  • INTERNAL - another error occurred in processing (represented by the exception "cause")
  • *
  • VALID - the token is valid
  • *
*/ public enum TokenState { MISSING("Token is missing.", false), INVALID("Invalid token signature.", false), EXPIRED("Expired token.", false), INTERNAL("Invalid key for token.", false), VALID("Token is valid.", true); private final String msg; private final boolean valid; TokenState(String msg, boolean valid) { this.msg = msg; this.valid = valid; } /** * * @return the message associated with this token state describing the cause to be in this state */ public String getMsg() { return msg; } /** * * @return {@code true} if this token state is valid, {@code false} otherwise */ public boolean isValid() { return valid; } @Override public String toString() { return this.msg; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy