blob: 9e0c2defaebcf0c64fd3a23b79c49503f0ea23ce [file] [log] [blame]
<!DOCTYPE HTML>
<html lang="" >
<head>
<meta charset="UTF-8">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Setup JWT security · Eclipse Kapua™ User Guide</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="description" content="">
<meta name="generator" content="GitBook 3.2.2">
<link rel="stylesheet" href="gitbook/style.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
<meta name="HandheldFriendly" content="true"/>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
<link rel="prev" href="simulator.html" />
</head>
<body>
<div class="book">
<div class="book-summary">
<div id="book-search-input" role="search">
<input type="text" placeholder="Type to search" />
</div>
<nav role="navigation">
<ul class="summary">
<li class="chapter " data-level="1.1" data-path="./">
<a href="./">
Introduction
</a>
</li>
<li class="chapter " data-level="1.2" data-path="rest.html">
<a href="rest.html">
REST API
</a>
</li>
<li class="chapter " data-level="1.3" data-path="community.html">
<a href="community.html">
Community
</a>
</li>
<li class="chapter " data-level="1.4" data-path="simulator.html">
<a href="simulator.html">
Simulator
</a>
</li>
<li class="chapter active" data-level="1.5" data-path="jwt_security.html">
<a href="jwt_security.html">
Setup JWT security
</a>
</li>
<li class="divider"></li>
<li>
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
Published with GitBook
</a>
</li>
</ul>
</nav>
</div>
<div class="book-body">
<div class="body-inner">
<div class="book-header" role="navigation">
<!-- Title -->
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i>
<a href="." >Setup JWT security</a>
</h1>
</div>
<div class="page-wrapper" tabindex="-1" role="main">
<div class="page-inner">
<div id="book-search-results">
<div class="search-noresults">
<section class="normal markdown-section">
<h1 id="jwt-security">JWT Security</h1>
<p>To leverage JWT security features, a pair of RSA keys (a public one and a private one) must be loaded in Kapua.</p>
<h2 id="use-random-generated-keys">Use random generated keys</h2>
<p>By default Kapua will look for keys in the path specified by <code>authentication.session.jwt.private.key</code> and <code>authentication.session.jwt.public.key</code> system properties at startup (see below). If such properties are not set Kapua will automatically generate new random private and public keys, while an error will be thrown if such files could not be found.</p>
<h2 id="use-custom-keys">Use custom keys</h2>
<p>If you want to use custom keys you can generate an RSA key pair with <a href="https://www.openssl.org/" target="_blank">OpenSSL</a>, and from that generate both the private and the public key. In order to create those files you can use the following commands:</p>
<pre><code class="lang-bash">openssl genrsa -out rsa-2048bit-key-pair.pem 2048
openssl pkcs8 -topk8 -inform pem -in rsa-2048bit-key-pair.pem -outform pem -nocrypt -out private.key
openssl rsa -in rsa-2048bit-key-pair.pem -pubout -out public.key
</code></pre>
<p>Both keys MUST be in PEM PKCS8 non encrypted format (encrypted privte keys are currently not supported). </p>
<p>Once created, the path must be specified in <code>authentication.session.jwt.private.key</code> and <code>authentication.session.jwt.public.key</code> system properties, either via -D startup parameter or by manually modifying <code>service/security/shiro/src/main/resources/kapua-authentication-setting.properties</code>.</p>
</section>
</div>
<div class="search-results">
<div class="has-results">
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
<ul class="search-results-list"></ul>
</div>
<div class="no-results">
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
</div>
</div>
</div>
</div>
</div>
</div>
<a href="simulator.html" class="navigation navigation-prev navigation-unique" aria-label="Previous page: Simulator">
<i class="fa fa-angle-left"></i>
</a>
</div>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Setup JWT security","level":"1.5","depth":1,"previous":{"title":"Simulator","level":"1.4","depth":1,"path":"simulator.md","ref":"simulator.md","articles":[]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"github":"eclipse/kapua","theme":"default","githubHost":"https://github.com/","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Eclipse Kapua™ User Guide","links":{"home":"http://eclipse.org/kapua"},"gitbook":"3.x.x","description":"Eclipse Kapua™ User Guide"},"file":{"path":"jwt_security.md","mtime":"2017-07-19T09:02:44.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-07-19T09:21:00.257Z"},"basePath":".","book":{"language":""}});
});
</script>
</div>
<script src="gitbook/gitbook.js"></script>
<script src="gitbook/theme.js"></script>
<script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
<script src="gitbook/gitbook-plugin-search/search.js"></script>
<script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
<script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
<script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
<script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
</body>
</html>