# 토큰 생성 예제

## 토큰 생성 예제 <a href="#toc460853036" id="toc460853036"></a>

### Java <a href="#toc460853037" id="toc460853037"></a>

Java-jwt 라이브러리를 사용하여 토큰을 생성하는 예제입니다. 자세한 설명은 공식 사이트를 참고하시길 바랍니다.

{% hint style="info" %}
\<java-jwt공식 사이트>

<https://github.com/auth0/java-jwt><br>
{% endhint %}

<figure><img src="/files/u1ZnlCYt9fTFweBAmT25" alt=""><figcaption><p>Sign JWT (HS256)</p></figcaption></figure>

<figure><img src="/files/NyvRC3gUoaLlqAl7DaNW" alt=""><figcaption><p>Verify JWT (HS256)</p></figcaption></figure>

### PHP <a href="#toc460853038" id="toc460853038"></a>

PHP-JWT 라이브러리를 사용하여 토큰을 생성하는 예제입니다. 자세한 설명은 공식 사이트를 참고하시길 바랍니다.

{% hint style="info" %}
< PHP-JWT 공식 사이트>

<https://github.com/firebase/php-jwt>
{% endhint %}

<figure><img src="/files/fii5CWUoFwX5xGAsVuI3" alt=""><figcaption><p>PHP-JWT</p></figcaption></figure>

## 스트리밍 서비스 <a href="#toc460853039" id="toc460853039"></a>

CDN 서비스에서 HTTP Pseudo Streaming, HTTP Live Streaming, MPEG-DASH 프로토콜을 지원합니다.

### URI 구조 <a href="#toc460853040" id="toc460853040"></a>

* 콘텐트 URI(Content URI)

사용자가 콘텐트를 재생할 수 있는 주소로서, 서비스 도메인(Service Domain)과 콘텐트 경로(Content Path) 그리고 Query(쿼리)로 구성됩니다. 아래는 라이브, VOD 서비스에서 HLS 프로토콜에 대한 예제입니다.

<table><thead><tr><th width="200">서비스 도메인</th><th width="209">콘텐트 경로</th><th>가상 파일</th><th>쿼리</th></tr></thead><tbody><tr><td>http://live.solbox.com</td><td>/foo/_definst_/sample.steam</td><td>playlist.m3u8</td><td>?token=eyJh…b9l4</td></tr><tr><td>http://vod.solbox.com</td><td>/foo/_definst_/sample.mp4</td><td>playlist.m3u8</td><td>?token=eyJh…b9l4</td></tr></tbody></table>

> * 서비스 도메인
>
> CDN 서비스에 접근하기 위한 서비스 도메인입니다.
>
> * 콘텐트 경로(Content Path)
>
> 콘텐트 저장소의 경로로서, 기본 URI 이후의 상대 경로를 포함한 파일명을 의미합니다.
>
> * 가상 파일(Virtual File)
>
> 다음 [가상파일](#_toc460853041)을 참고하세요.

### 가상 파일(Virtual File) <a href="#toc460853041" id="toc460853041"></a>

플레이어에서 정상적으로 재생하기 위해서는 프로토콜 별로 URL에 가상 파일을 접미어(Suffix)로 붙여줘야 합니다. (다음 [프로토콜에 따른 전달 방법](#_toc460853042)의 예시를 참고하세요.)

반면에 보안 토큰의 인증 경로(path)에는 가상 파일을 반드시 제외해야 합니다.\
아래 표는 프로토콜에 따른 가상 파일을 보여줍니다.

| 스트리밍 프로토콜             | 가상 파일         |
| --------------------- | ------------- |
| HTTP Pseudo Streaming | content.mp4   |
| HTTP Live Streaming   | playlist.m3u8 |
| MPEG-DASH             | manifest.mpd  |

### 프로토콜에 따른 전달 방법. <a href="#toc460853042" id="toc460853042"></a>

* HTTP Pseudo Streaming
  * 콘텐트 경로: /foo/\_definst\_/sample.mp4
  * 가상 파일: content.mp4

> *<http://vod.solbox.com><mark style="color:blue;">/foo/\_definst\_/sample.mp4/</mark><mark style="color:red;">content.mp4</mark>?<mark style="color:green;">token=</mark>* <mark style="color:green;"></mark><mark style="color:green;">eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NjI0ODA3ODMwLCJwYXRoIjoiL2Zvby9fZGVmaW5zdF8vc2FtcGxlLm1wNCJ9.WljNKKqjc22nXSFJQzzoD4D9pfhAZSp7HboSNs\_huv8</mark>

* HTTP Live Streaming
  * 라이브
    * 콘텐트 경로: /foo/\_definst\_/sample.stream
    * 가상 파일: playlist.m3u8

> *<http://live.solbox.com><mark style="color:blue;">/foo/\_definst\_/sample.stream/</mark><mark style="color:red;">playlist.m3u8?</mark><mark style="color:green;">token=</mark>* <mark style="color:green;"></mark><mark style="color:green;">eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NjI0ODA3ODMwLCJwYXRoIjoiL2Zvby9fZGVmaW5zdF8vc2FtcGxlLm1wNCJ9.WljNKKqjc22nXSFJQzzoD4D9pfhAZSp7HboSNs\_huv8</mark>

* VOD
  * 콘텐트 경로: /foo/\_definst\_/sample.mp4
  * 가상 파일: playlist.m3u8

> *<http://vod.solbox.com><mark style="color:blue;">/foo/\_definst\_/sample.mp4/</mark><mark style="color:red;">playlist.m3u8?</mark><mark style="color:green;">token=</mark>* <mark style="color:green;"></mark><mark style="color:green;">eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NjI0ODA3ODMwLCJwYXRoIjoiL2Zvby9fZGVmaW5zdF8vc2FtcGxlLm1wNCJ9.WljNKKqjc22nXSFJQzzoD4D9pfhAZSp7HboSNs\_huv8</mark>

* MPEG-DASH
  * 라이브
    * 콘텐트 경로: /foo/\_definst\_/sample.stream
    * 가상 파일: manifest.mpd

> *<http://live.solbox.com><mark style="color:blue;">/foo/\_definst\_/sample.stream/</mark><mark style="color:red;">manifest.mpd?</mark><mark style="color:green;">token=</mark>* <mark style="color:green;"></mark><mark style="color:green;">eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NjI0ODA3ODMwLCJwYXRoIjoiL2Zvby9fZGVmaW5zdF8vc2FtcGxlLm1wNCJ9.WljNKKqjc22nXSFJQzzoD4D9pfhAZSp7HboSNs\_huv8</mark>

* VOD
  * 콘텐트 경로: /foo/\_definst\_/sample.mp4
  * 가상 파일: manifest.mpd

> *<http://vod.solbox.com><mark style="color:blue;">/foo/\_definst\_/sample.mp4/</mark><mark style="color:red;">manifest.mpd?</mark><mark style="color:green;">token=</mark>* <mark style="color:green;"></mark><mark style="color:green;">eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NjI0ODA3ODMwLCJwYXRoIjoiL2Zvby9fZGVmaW5zdF8vc2FtcGxlLm1wNCJ9.WljNKKqjc22nXSFJQzzoD4D9pfhAZSp7HboSNs\_huv8</mark>

본 문서와 관련해서 보다 자세하고 구체적인 설명을 원하는 경우 아래 문서를 참고해주시길 바랍니다.

<table><thead><tr><th width="437">문서 제목</th><th>설명</th></tr></thead><tbody><tr><td><a href="http://en.wikipedia.org/wiki/Basic_access_authentication">http://en.wikipedia.org/wiki/Basic_access_authentication</a></td><td>Basic access authentication</td></tr><tr><td><a href="http://jwt.io">http://jwt.io</a></td><td>JWT 디버거 제공.</td></tr><tr><td><a href="https://tools.ietf.org/html/rfc7519">https://tools.ietf.org/html/rfc7519</a></td><td>JWT 표준 문서</td></tr><tr><td><a href="http://bcho.tistory.com">http://bcho.tistory.com</a></td><td>JWT에 대한 설명.</td></tr><tr><td><a href="http://blog.outsider.ne.kr/1160">http://blog.outsider.ne.kr/1160</a></td><td>JWT에 대한 설명.</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://manual.solbox.com/secure_token/undefined.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
