Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (C) 2023 Authlete, 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
*
* https://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 com.authlete.cwt;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.authlete.cbor.CBORByteArray;
import com.authlete.cbor.CBORDecoder;
import com.authlete.cbor.CBORDecoderException;
import com.authlete.cbor.CBORItem;
import com.authlete.cbor.CBORNull;
import com.authlete.cbor.CBORPair;
import com.authlete.cbor.CBORPairList;
import com.authlete.cbor.CBORizer;
import com.authlete.cwt.constants.CWTClaims;
/**
* CWT Claims Set
*
* @since 1.4
*
* @see RFC 8392 CBOR Web Token (CWT)
*
* @see IANA: CBOR Web Token (CWT) Claims
*/
public class CWTClaimsSet extends CBORPairList
{
private String iss;
private String sub;
private String aud;
private Date exp;
private Date nbf;
private Date iat;
private byte[] cti;
private byte[] nonce;
/**
* A constructor with label-value pairs that represent claims.
*
* @param pairs
* Claims.
*
* @throws IllegalArgumentException
* There is one or more claims that do not conform to the
* requirements of RFC 8392 Section 3. Claims.
*/
public CWTClaimsSet(List extends CBORPair> pairs) throws IllegalArgumentException
{
super(pairs);
validateClaims(pairs);
}
private void validateClaims(List extends CBORPair> pairs)
{
// Validate the label-value pairs.
Map