001/* 002 * Copyright 2026 Revetware LLC. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package com.revetsec.jose; 018 019import org.jspecify.annotations.NonNull; 020 021import javax.annotation.concurrent.Immutable; 022 023/** 024 * A supported JWT protected-header {@code typ} value used when signing a token. 025 * The token type describes its intended use; it is separate from the claims and signing algorithm. 026 * <p> 027 * This enum is not switch-stable: a later release may add constants, so a {@code switch} over it needs a default 028 * branch. 029 * 030 * @author <a href="https://www.revetkn.com">Mark Allen</a> 031 * @since 1.0.0 032 */ 033@Immutable 034public enum JwtType { 035 /** 036 * A general-purpose JWT ({@code JWT}). 037 */ 038 JWT("JWT"), 039 /** 040 * A JWT access token ({@code at+jwt}). 041 */ 042 ACCESS_TOKEN("at+jwt"), 043 /** 044 * A JWT client authentication assertion ({@code client-authentication+jwt}). 045 */ 046 CLIENT_AUTHENTICATION("client-authentication+jwt"); 047 048 private final @NonNull String wireValue; 049 050 JwtType(@NonNull String wireValue) { 051 this.wireValue = wireValue; 052 } 053 054 /** 055 * Returns this type's exact protected-header {@code typ} value. 056 * 057 * @return the wire value 058 * @since 1.0.0 059 */ 060 public @NonNull String getWireValue() { 061 return this.wireValue; 062 } 063}