<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>documentation &#8211; privacyID3A</title>
	<atom:link href="https://www.privacyidea.org/category/documentation/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.privacyidea.org</link>
	<description>flexible, Open Source Multi Factor Authentication (2FA)</description>
	<lastBuildDate>Wed, 12 Feb 2020 12:00:41 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.privacyidea.org/wp-content/uploads/2016/06/cropped-only-logo-white-background-32x32.png</url>
	<title>documentation &#8211; privacyID3A</title>
	<link>https://www.privacyidea.org</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Setup secure authentication with iOS privacyIDEA Push Token</title>
		<link>https://www.privacyidea.org/setup-secure-authentication-with-ios-privacyidea-push-token/</link>
					<comments>https://www.privacyidea.org/setup-secure-authentication-with-ios-privacyidea-push-token/#comments</comments>
		
		<dc:creator><![CDATA[Cornelius Kölbel]]></dc:creator>
		<pubDate>Wed, 12 Feb 2020 12:00:39 +0000</pubDate>
				<category><![CDATA[documentation]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Push Token]]></category>
		<guid isPermaLink="false">https://www.privacyidea.org/?p=1707</guid>

					<description><![CDATA[Use iPhone for 2FA with Push Notification against privacyIDEA.]]></description>
										<content:encoded><![CDATA[
<p>In a previous post we explained <a href="https://www.privacyidea.org/testing-privacyidea-push-token/">how you can setup Push authentication with privacyIDEA</a>. This gives you the basic configuration in privacyIDEA, sets up your Firebase project and works well with Android based smartphones.</p>



<p>However with iOS devices things are a bit more complicated and <em>additional</em> steps have to be taken. These <em>additional</em> steps are described in this blog post.</p>



<h2 class="wp-block-heading">Apple push apps &#8211; different than Android</h2>



<p>The Firebase service can not directly push to apple devices. Instead, the Firebase service pushes to the Apple Notification Service. While Android allows an app to be connected to different Firebase projects, an iOS app with it&#8217;s app identifier can only be connected to one Apple Push project. </p>



<p>What does this mean?</p>



<p>For the Android devices you created a Firebase project. Your <em>own</em> Firebase project. You configure the data in the privacyIDEA server and the information about the Firebase project is passed to the privacyIDEA Authenticator<strong><em> for Android </em></strong>during the rollout process. This means that a privacyIDEA installation running with organization A connects the push tokens to their own Firebase project and organization B will connect their push tokens to a totally different own Firebase project.</p>



<p>Unfortunately this is not possible with the Apple Notification Service. NetKnights, the company behind privacyIDEA, created one Apple Notification Service project. The secret push key of this project is connected to the app identifier &#8220;privacyidea.authenticator&#8221; of the  privacyIDEA Authenticator App for iOS. The privacyIDEA installation in organization A sends the push notification for an iOS device to the organization&#8217;s own Firebase project, but then the Firebase project will forward the notification to the general Apple Notification Service project. This second step will be the same for all Push notifications to iOS devices connected to any privacyIDEA installation on this planet. This <strong><em>probably </em></strong>arises from Apples cloud-centric idea, that <strong><em>probably </em></strong>an app will only receive notifications from <em> one central cloud</em> service.</p>



<p>However, during enrollment of the iOS privacyIDEA Authenticator the app sends a random device identifier to your privacyIDEA server. Your privacyIDEA installation then uses this random identifier to send the push notification to this very device. It seems unlikely for another privacyIDEA installation to guess the device identifier of a foreign Apple device. If an attacker was able to guess a random device identifier the attacker could send arbitrary notifications to the iOS device. But in addition the iOS privacyIDEA Authenticator is also registered to your <em>own</em> Firebase project. This means, that the attacker indeed could send an arbitrary notification but such notification would not be processed by the privacyIDEA Authenticator.</p>



<p>If you do not like this (which we would understand) you need to recompile the privacyIDEA Authenticator for iOS with your own <strong><em>Apple Notification Service project</em></strong>, with your own Apple developer account, your own certificate and push notification key and with your own app identifier. Just like all other privacyIDEA code, the <a href="https://github.com/privacyidea/privacyidea-authenticator-ios">privacyidea-authenticator-ios</a> is available on github.</p>



<p>NetKnights hopes to be able to provide customization services one day to create customer specific apps as part of a privacyIDEA Authenticator Enterprise Edition, to circumvent this problem.</p>



<p>After this lengthy disclaimer lets now connect Firebase with the Apple Notification Service especially with the privacyIDEA Authenticator.</p>



<p><strong>Note</strong>: This howto discloses the secret project key, which is needed so that Firebase can send messages to the Apple Notification Service. This means, that an attacker could &#8211; after successfully guessing a device identifier &#8211; potentially <em>spam</em> messages to devices connected to the privacyIDEA Apple Notification Service. However, the impact on login security is none, since all messages are digitally signed in both directions. Again: This downside is due to the cloud-centric design or the Apple Notification Service and can only be avoided by compiling your own Authenticator app and publishing it to the Apple app store.</p>



<p>But let&#8217;s do the iOS device, now!</p>



<h2 class="wp-block-heading">Add new Firebase App</h2>



<p>In the <a href="https://console.firebase.google.com/" target="_blank" rel="noreferrer noopener" aria-label="Firebase console (opens in a new tab)">Firebase console</a>, you need to create a new App in your Firebase project. Do so so click the button &#8220;+ Add app&#8221;.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img fetchpriority="high" decoding="async" width="1024" height="476" src="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-01-add-app-1024x476.png" alt="" class="wp-image-1715" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-01-add-app-1024x476.png 1024w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-01-add-app-300x140.png 300w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-01-add-app-768x357.png 768w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-01-add-app.png 1034w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure></div>



<p>The new app you want to create, is an iOS app. So click the round button &#8220;iOS&#8221;.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img decoding="async" width="1005" height="410" src="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-02-add-ios-app.png" alt="" class="wp-image-1716" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-02-add-ios-app.png 1005w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-02-add-ios-app-300x122.png 300w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-02-add-ios-app-768x313.png 768w" sizes="(max-width: 1005px) 100vw, 1005px" /></figure></div>



<p>In the app registration dialog you need to create an iOS bundle ID. Creating a nickname is optional. For the <a href="https://developer.apple.com/documentation/appstoreconnectapi/bundle_ids">bundle ID</a> you need to enter &#8220;privacyidea.authenticator&#8221;. Choose a nickname to your likings.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img decoding="async" width="558" height="549" src="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-03-register-app.png" alt="" class="wp-image-1717" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-03-register-app.png 558w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-03-register-app-300x295.png 300w" sizes="(max-width: 558px) 100vw, 558px" /></figure></div>



<p>In the second step of the app registration you need to download the plist file. Save it for later, you need to enter the settings from within this file in your privacyIDEA policy.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="743" height="661" src="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-04-download-for-later.png" alt="" class="wp-image-1718" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-04-download-for-later.png 743w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-04-download-for-later-300x267.png 300w" sizes="auto, (max-width: 743px) 100vw, 743px" /></figure></div>



<p>In the third step you do not need to take any actions. You do not bother with the SDK, since the privacyIDEA Authenticator iOS app already exists!</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="732" height="787" src="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-05-no-need-to-take-any-achtion-here.png" alt="" class="wp-image-1719" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-05-no-need-to-take-any-achtion-here.png 732w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-05-no-need-to-take-any-achtion-here-279x300.png 279w" sizes="auto, (max-width: 732px) 100vw, 732px" /></figure></div>



<p>Also in the next step you do not need to take any action. Simply press &#8220;Next&#8221;.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="757" height="899" src="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-06-no-need-to-take-any-action-here.png" alt="" class="wp-image-1720" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-06-no-need-to-take-any-action-here.png 757w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-06-no-need-to-take-any-action-here-253x300.png 253w" sizes="auto, (max-width: 757px) 100vw, 757px" /></figure></div>



<p>Now you are done registering your iOS app and you can &#8220;Continue to console&#8221;.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="743" height="651" src="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-07-return-to-console.png" alt="" class="wp-image-1722" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-07-return-to-console.png 743w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-07-return-to-console-300x263.png 300w" sizes="auto, (max-width: 743px) 100vw, 743px" /></figure></div>



<h2 class="wp-block-heading">Adding the secret iOS Authentication key</h2>



<p>After you have told the Firebase service, that also iOS devices are going to connect to it, you now need to tell Firebase, how it can talk to the Apple Notification Service. For this you need the secret key we talked about at the <a rel="noopener noreferrer" href="#note" target="_blank">beginning</a> of this article. If you do not want to compile your own app and publish it in the app store, you unfortunately have to share the &#8220;secret&#8221; key with all other default installations of privacyIDEA. Download the <a rel="noreferrer noopener" href="https://privacyidea.org/wp-content/uploads/2020/02/AuthKey_2FZRBAT74S.p8" target="_blank">secret key file</a> to your computer and save it for later. </p>



<p>Still in the Firebase console, first go to the &#8220;Project settings&#8221; in the upper left corner</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="495" height="238" src="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-08-project-settings.png" alt="" class="wp-image-1723" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-08-project-settings.png 495w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-08-project-settings-300x144.png 300w" sizes="auto, (max-width: 495px) 100vw, 495px" /></figure></div>



<p>In the &#8220;Settings&#8221; go to the tab &#8220;Cloud Messaging&#8221;.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="495" height="270" src="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-09-cloud-messaging.png" alt="" class="wp-image-1724" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-09-cloud-messaging.png 495w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-09-cloud-messaging-300x164.png 300w" sizes="auto, (max-width: 495px) 100vw, 495px" /></figure></div>



<p>In &#8220;Cloud Messaging&#8221; you will find the &#8220;iOS app configuration&#8221;. There you can hit &#8220;Upload&#8221; to upload the secret key file. </p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="999" height="409" src="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-09-upload-auth-key.png" alt="" class="wp-image-1725" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-09-upload-auth-key.png 999w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-09-upload-auth-key-300x123.png 300w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-09-upload-auth-key-768x314.png 768w" sizes="auto, (max-width: 999px) 100vw, 999px" /></figure></div>



<p>Now select the secret key file (AuthKey_2FZRBAT74S.p8) to upload it to the Firebase console.</p>



<p>Enter the Key ID (2FZRBAT74S) and Team ID (627QALYL3B) exactly as stated in the image below.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="669" height="551" src="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-10-select-key-file.png" alt="" class="wp-image-1726" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-10-select-key-file.png 669w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-10-select-key-file-300x247.png 300w" sizes="auto, (max-width: 669px) 100vw, 669px" /></figure></div>



<p>After hitting the &#8220;Upload&#8221; button you should be fine and your Firebase Push Service is connected to the Apple Notification Service for the privacyIDEA Authenticator iOS App.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="985" height="379" src="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-11-auth-key-successfully-uploaded.png" alt="" class="wp-image-1728" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-11-auth-key-successfully-uploaded.png 985w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-11-auth-key-successfully-uploaded-300x115.png 300w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-11-auth-key-successfully-uploaded-768x296.png 768w" sizes="auto, (max-width: 985px) 100vw, 985px" /></figure></div>



<h2 class="wp-block-heading">Configure iOS Authenticator in privacyIDEA</h2>



<p>Now open the plist file you saved earlier. Find the entries API_KEY and GOOGLE_APP_ID. It will look like this:</p>



<pre class="wp-block-code"><code>&lt;?xml version="1.0" encoding="UTF-8"?>
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
&lt;plist version="1.0">
&lt;dict>
        ...
	&lt;key>API_KEY&lt;/key>
	&lt;string>example-key_value&lt;/string>
        ...
    	&lt;key>GOOGLE_APP_ID&lt;/key>
	&lt;string>1:example:ios:appid&lt;/string>
&lt;/dict>
&lt;/plist></code></pre>



<p>You need to enter the value &#8220;example-key_value&#8221; in <em>apikeyios</em> and the value &#8220;1:example:ios:appid&#8221; in <em>appidios</em>.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="693" src="https://www.privacyidea.org/wp-content/uploads/2020/02/iOS-push-12-configure-privacyidea-1024x693.png" alt="" class="wp-image-1749" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/iOS-push-12-configure-privacyidea-1024x693.png 1024w, https://www.privacyidea.org/wp-content/uploads/2020/02/iOS-push-12-configure-privacyidea-300x203.png 300w, https://www.privacyidea.org/wp-content/uploads/2020/02/iOS-push-12-configure-privacyidea-768x520.png 768w, https://www.privacyidea.org/wp-content/uploads/2020/02/iOS-push-12-configure-privacyidea.png 1191w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>Now you are ready to register iOS devices with your privacyIDEA Push setup and use your iPhones to authenticate via Push notification.</p>



<p>If you want to stay tuned for the enterprise edition, please consider <a href="https://netknights.it/en/unternehmen/kontakt/" target="_blank" rel="noreferrer noopener" aria-label="contacting the company NetKnights (opens in a new tab)">contacting the company NetKnights</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.privacyidea.org/setup-secure-authentication-with-ios-privacyidea-push-token/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>privacyIDEA as authproc filter in simpleSAMLphp</title>
		<link>https://www.privacyidea.org/privacyidea-as-authproc-filter-in-simplesamlphp/</link>
		
		<dc:creator><![CDATA[Micha Preußer]]></dc:creator>
		<pubDate>Wed, 02 Jan 2019 12:58:48 +0000</pubDate>
				<category><![CDATA[documentation]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[simpleSAMLphp]]></category>
		<guid isPermaLink="false">https://www.privacyidea.org/?p=1461</guid>

					<description><![CDATA[What is an authproc filter and why should I use it? An authentication processing filter is one step of the login process in simpleSAMLphp. For example it can be useful, if you want to authenticate the first factor against LDAP and the second one against privacyIDEA. If you enable privacyIDEA as an authsource, both factors [&#8230;]]]></description>
										<content:encoded><![CDATA[<h3>What is an authproc filter and why should I use it?</h3>
<p>An authentication processing filter is one step of the login process in simpleSAMLphp.<br />
For example it can be useful, if you want to authenticate the first factor against LDAP and the second one against privacyIDEA.<br />
If you enable privacyIDEA as an authsource, both factors will be authenticated against privacyIDEA.</p>
<p>With privacyIDEA as an authproc filter, you are much more flexible. You can expand and individualize the authentication process in many different ways. In this how-to we want to explain some of the features and show how to configure it in the best way.</p>
<p><a href="https://www.privacyidea.org/wp-content/uploads/2019/01/simpleSAMLphp-2FA-otp.png"><img loading="lazy" decoding="async" class="alignnone size-large wp-image-1465" src="https://www.privacyidea.org/wp-content/uploads/2019/01/simpleSAMLphp-2FA-otp-1024x578.png" alt="" width="1024" height="578" srcset="https://www.privacyidea.org/wp-content/uploads/2019/01/simpleSAMLphp-2FA-otp-1024x578.png 1024w, https://www.privacyidea.org/wp-content/uploads/2019/01/simpleSAMLphp-2FA-otp-300x169.png 300w, https://www.privacyidea.org/wp-content/uploads/2019/01/simpleSAMLphp-2FA-otp-768x433.png 768w, https://www.privacyidea.org/wp-content/uploads/2019/01/simpleSAMLphp-2FA-otp-528x297.png 528w, https://www.privacyidea.org/wp-content/uploads/2019/01/simpleSAMLphp-2FA-otp.png 1099w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<h3>How to setup privacyIDEA as an authproc filter</h3>
<p>Authproc filters are configured in config.php (to use them every time) or in the metadata (to use it only, if the user comes from a specific service provider for example). Every authproc filter is listed in an array with a number, which shows the priority. The lowest number begins the login process.</p>
<h4>privacyIDEA without special features (necessary)</h4>
<pre><code class="language-php">'authproc' =&gt; array(
  20 =&gt; array(
    'class'             =&gt; 'privacyidea:serverconfig',
    'privacyideaserver' =&gt; 'https://your.privacyidea.server',
    'realm'             =&gt; 'realm1',
    'uidKey'            =&gt; 'uid',
    'sslverifyhost'     =&gt; true,
    'sslverifypeer'     =&gt; true,
    'serviceAccount'  =&gt; 'service',
    'servicePass'     =&gt; 'service',
  ),
  25 =&gt; array(
    'class'             =&gt; 'privacyidea:privacyidea',
  ),
),
</code></pre>
<p>This configuration enables the authentication against privacyIDEA. The first factor will be authenticated against the authsource (e.g. LDAP) and the second one against privacyIDEA.</p>
<ul>
<li>class: this enables the authproc filter. (Do not change it)</li>
<li>privacyideaserver: here you can enter the url of your pricacyIDEA server</li>
<li>realm: enter the user&#8217;s realm name</li>
<li>uidKey: privacyIDEA has to know in which attribute the username is stored (it depends on your authsource)</li>
<li>sslverifyhost: Check if the hostname matches the name in the certificate (set to true or false)</li>
<li>sslverifypeer: Check if the certificate is valid, signed by a trusted CA (true or false)</li>
<li>serviceAccount: The service account&#8217;s username</li>
<li>servicePass: The service account&#8217;s password</li>
</ul>
<h4>Disable 2FA for users with specified ip addresses (optional)</h4>
<p>You can disable 2FA for users with a special ip address (e.g. your local area network).<br />
To do that, you have to enable and configure the authproc filter privacyidea:checkClientIP</p>
<pre><code class="language-php">21 =&gt; array (
  'class'             =&gt; 'privacyidea:checkClientIP',
  'excludeClientIPs'  =&gt; array("10.0.0.0-10.2.0.0", "192.168.178.10"),
),
</code></pre>
<p>This array has to be in the authproc array, which is mentioned above.</p>
<ul>
<li>class: this enables the authproc filter.</li>
<li>excludeClientIPs: You can enter a single ip address or a range. These clients will not be asked to do 2FA.</li>
</ul>
<h4>Enroll new token, if the user does not have one (optional)</h4>
<p>If a user does not have a second factor yet, it can be enrolled by simpleSAMLphp. To do that, a service account has to be configured and enabled. This can be done either above in privacyidea:privacyidea or here in privacyidea:tokenEnrollment)</p>
<pre><code class="language-php">24 =&gt; array(
  'class'           =&gt; 'privacyidea:tokenEnrollment',
  'tokenType'       =&gt; 'totp',
)
</code></pre>
<ul>
<li>class: this enables the authproc filter</li>
<li>tokenType: Here you can enter the token type. It can be hotp or totp</li>
</ul>
<p>You can overwrite the settings from privacyidea:serverconfig, if it is necessary. For example you can change the serviceAccount and servicePass. You only have to add it in this array.</p>
<p><a href="https://www.privacyidea.org/wp-content/uploads/2019/01/simpleSAMLphp-2FA-enroll.png"><img loading="lazy" decoding="async" class="alignnone wp-image-1463 size-large" src="https://www.privacyidea.org/wp-content/uploads/2019/01/simpleSAMLphp-2FA-enroll-1024x576.png" alt="" width="1024" height="576" srcset="https://www.privacyidea.org/wp-content/uploads/2019/01/simpleSAMLphp-2FA-enroll-1024x576.png 1024w, https://www.privacyidea.org/wp-content/uploads/2019/01/simpleSAMLphp-2FA-enroll-300x169.png 300w, https://www.privacyidea.org/wp-content/uploads/2019/01/simpleSAMLphp-2FA-enroll-768x432.png 768w, https://www.privacyidea.org/wp-content/uploads/2019/01/simpleSAMLphp-2FA-enroll-1110x624.png 1110w, https://www.privacyidea.org/wp-content/uploads/2019/01/simpleSAMLphp-2FA-enroll-528x297.png 528w, https://www.privacyidea.org/wp-content/uploads/2019/01/simpleSAMLphp-2FA-enroll.png 1430w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Highest flexibility with the tokeninfo fields</title>
		<link>https://www.privacyidea.org/highest-flexibility-tokeninfo-fields/</link>
		
		<dc:creator><![CDATA[Cornelius Kölbel]]></dc:creator>
		<pubDate>Thu, 09 Nov 2017 21:43:06 +0000</pubDate>
				<category><![CDATA[documentation]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[Event Handler]]></category>
		<category><![CDATA[Tokeninfo]]></category>
		<guid isPermaLink="false">https://www.privacyidea.org/?p=1273</guid>

					<description><![CDATA[On a wish list for another OTP solutions I saw the requirement to have an &#8220;enrollment date&#8221; or a &#8220;last use date&#8221; of a token. Well, you might know, that privacyIDEA can do all this. Then you are welcome to skip this blog post and visit the privacyIDEA community to help answering questions there. Thanks [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>On a wish list for another OTP solutions I saw the requirement to have an &#8220;enrollment date&#8221; or a &#8220;last use date&#8221; of a token.</p>
<p>Well, you might know, that privacyIDEA can do all this. Then you are welcome to skip this blog post and visit the <a href="https://community.privacyidea.org" target="_blank" rel="noopener">privacyIDEA community</a> to help answering questions there. Thanks a lot! If not &#8211; go on reading!</p>
<h2>The tokeninfo table</h2>
<p>Every token has its own Tokeninfo table, that can hold any additional arbitrary information. In the UI it looks like this:</p>
<p><a href="https://www.privacyidea.org/wp-content/uploads/2017/11/Bildschirmfoto-vom-2017-11-09-21-50-29.png"><img loading="lazy" decoding="async" class="aligncenter wp-image-1274 size-full" src="https://www.privacyidea.org/wp-content/uploads/2017/11/Bildschirmfoto-vom-2017-11-09-21-50-29.png" alt="" width="565" height="75" srcset="https://www.privacyidea.org/wp-content/uploads/2017/11/Bildschirmfoto-vom-2017-11-09-21-50-29.png 565w, https://www.privacyidea.org/wp-content/uploads/2017/11/Bildschirmfoto-vom-2017-11-09-21-50-29-300x40.png 300w" sizes="auto, (max-width: 565px) 100vw, 565px" /></a></p>
<p>It tells us that the used hashlib is &#8220;sha1&#8221; and the token was used 3 times for authentication.</p>
<p>On the database level the tokeninfo is a table on its own, which means that every token can hold as many token information as it needs to:</p>
<p><figure id="attachment_1275" aria-describedby="caption-attachment-1275" style="width: 724px" class="wp-caption aligncenter"><a href="https://www.privacyidea.org/wp-content/uploads/2017/11/tokeninfo-table.png"><img loading="lazy" decoding="async" class="wp-image-1275 size-full" src="https://www.privacyidea.org/wp-content/uploads/2017/11/tokeninfo-table.png" alt="" width="724" height="215" srcset="https://www.privacyidea.org/wp-content/uploads/2017/11/tokeninfo-table.png 724w, https://www.privacyidea.org/wp-content/uploads/2017/11/tokeninfo-table-300x89.png 300w" sizes="auto, (max-width: 724px) 100vw, 724px" /></a><figcaption id="caption-attachment-1275" class="wp-caption-text">A view on the tokeninfo database table</figcaption></figure></p>
<p>It does not matter where and how you add tokeninfos to this table. privacyIDEA will use them.</p>
<p>privacyIDEA knows some default or preserve keywords, for which it is using the tokeninfo table. This is the <a href="http://privacyidea.readthedocs.io/en/latest/modules/lib/tokenclass.html#privacyidea.lib.tokenclass.TokenClass.get_validity_period_end" target="_blank" rel="noopener">validity period</a> of a token, that is denoted with &#8220;validity_period_start&#8221; and &#8220;validity_period_end&#8221;, the &#8220;count_auth&#8221; or &#8220;count_auth_success&#8221; and also markes that define for how many authentications a token can be used.</p>
<p>But you can also set any other value.</p>
<h2>Event Handler and tokeninfo</h2>
<p>There are probably many ways to set tokeninfo fields, but obviously the most interesting way is the event handler. If you do not know the event handler yet, you can either read about it in <a href="https://www.privacyidea.org/most-flexible-two-factor-authentication-handling-your-events/">our blog</a> or in the <a href="http://privacyidea.readthedocs.io/en/latest/eventhandler/index.html" target="_blank" rel="noopener">online documentation</a>.</p>
<p>Using the <strong>Token Handler</strong> you can set a tokeninfo field during any REST API call. You could e.g. set a tokeninfo field &#8220;enrollment_date&#8221; and hook it to the event <strong>/token/init</strong>.</p>
<p><a href="https://www.privacyidea.org/wp-content/uploads/2017/11/event-enrollment-date.png"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-1278" src="https://www.privacyidea.org/wp-content/uploads/2017/11/event-enrollment-date.png" alt="" width="840" height="663" srcset="https://www.privacyidea.org/wp-content/uploads/2017/11/event-enrollment-date.png 840w, https://www.privacyidea.org/wp-content/uploads/2017/11/event-enrollment-date-300x237.png 300w, https://www.privacyidea.org/wp-content/uploads/2017/11/event-enrollment-date-768x606.png 768w" sizes="auto, (max-width: 840px) 100vw, 840px" /></a></p>
<p>As mentioned, you can set any arbitrary tokeninfo field. In this case we set the &#8220;enrollment_date&#8221; to the current time. The timestamp of the current time will be saved in the token info.</p>
<p>Well, why not immediately and automatically set the validity period? No problem: The value can not only use tags, but also <a href="http://privacyidea.readthedocs.io/en/latest/eventhandler/tokenhandler.html#set-tokeninfo" target="_blank" rel="noopener">some other magic</a>:</p>
<p><a href="https://www.privacyidea.org/wp-content/uploads/2017/11/set-validity.png"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-1279" src="https://www.privacyidea.org/wp-content/uploads/2017/11/set-validity.png" alt="" width="847" height="674" srcset="https://www.privacyidea.org/wp-content/uploads/2017/11/set-validity.png 847w, https://www.privacyidea.org/wp-content/uploads/2017/11/set-validity-300x239.png 300w, https://www.privacyidea.org/wp-content/uploads/2017/11/set-validity-768x611.png 768w" sizes="auto, (max-width: 847px) 100vw, 847px" /></a></p>
<p>Setting the value of &#8220;validity_period_end&#8221; to &#8220;{current_time}+12&#8221; will result in a timestamp, that is 12 days in the future. Combining this with the reserved key &#8220;validity_period_end&#8221; we can automatically enroll tokens, that are only valid for 12 days!</p>
<h2>How to use tokeninfo fields</h2>
<p>privacyIDEA knows how to use the preserved tokeninfo fields. These actions are hard wired into the code.<br />
Of course you can use any arbitrary field simply to pass information to a help desk employee or to store some notes. But there are again at lease two interesting way how to automatically use the tokeinfo field.</p>
<h3>Again the event handler</h3>
<p>Again &#8211; you can use the tokeninfo field with the event handler. <a href="http://privacyidea.readthedocs.io/en/latest/eventhandler/index.html#basic-conditions" target="_blank" rel="noopener">But this time as a condition</a>. For any REST API call you can check the tokeninfo field of the token involved. And if any arbitrary (I like this word!) tokeninfo field matches your condition, you can trigger a new action.</p>
<p>A condition could be anything or a fixed timestamp but also &#8211; again &#8211; &#8220;{now}&#8221;:</p>
<p><a href="https://www.privacyidea.org/wp-content/uploads/2017/11/condition-now.png"><br />
<img loading="lazy" decoding="async" class="aligncenter size-full wp-image-1284" src="https://www.privacyidea.org/wp-content/uploads/2017/11/condition-now.png" alt="" width="947" height="339" srcset="https://www.privacyidea.org/wp-content/uploads/2017/11/condition-now.png 947w, https://www.privacyidea.org/wp-content/uploads/2017/11/condition-now-300x107.png 300w, https://www.privacyidea.org/wp-content/uploads/2017/11/condition-now-768x275.png 768w" sizes="auto, (max-width: 947px) 100vw, 947px" /></a></p>
<p>This way we can check if the tokeninfo field &#8220;validity_period_end&#8221; has a youger timestamp than the current moment. Only if the condition applies the defined action will be triggered.</p>
<p>But often &#8220;now&#8221; is not the right moment!</p>
<p><a href="https://www.privacyidea.org/wp-content/uploads/2017/11/tokenenrolled-lastweek.png"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-1285" src="https://www.privacyidea.org/wp-content/uploads/2017/11/tokenenrolled-lastweek.png" alt="" width="921" height="273" srcset="https://www.privacyidea.org/wp-content/uploads/2017/11/tokenenrolled-lastweek.png 921w, https://www.privacyidea.org/wp-content/uploads/2017/11/tokenenrolled-lastweek-300x89.png 300w, https://www.privacyidea.org/wp-content/uploads/2017/11/tokenenrolled-lastweek-768x228.png 768w" sizes="auto, (max-width: 921px) 100vw, 921px" /></a></p>
<p>In this example the action will only trigger, if the &#8220;enrollment_date&#8221; is older than one week. You can use the tag &#8220;{now}-7d&#8221; which will result in a timestamp of last week!</p>
<p>Combined with the event handlers for <strong>notification, scripting, token handling or federation</strong> the administrator can probably define anything and automate a lot of processes!</p>
<h3>Clean it! The token janitor</h3>
<p>There is also another way of using the tokeninfo fields. It is the tokenjanitor script.</p>
<p>The privacyidea-token-janitor runs as a script from the command line and find specific tokens and perform actions on these tokens. It was first used to <a href="http://privacyidea.readthedocs.io/en/latest/modules/lib/tokenclass.html#privacyidea.lib.tokenclass.TokenClass.is_orphaned" target="_blank" rel="noopener">find orphaned tokens</a> and possibly delete these orphaned tokens.</p>
<p>But of course the token-janitor can find tokens based on may conditions &#8211; also based on the tokeninfo field.</p>
<p><a href="https://www.privacyidea.org/wp-content/uploads/2017/11/privacyidea-token-janitor.png"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-1289" src="https://www.privacyidea.org/wp-content/uploads/2017/11/privacyidea-token-janitor.png" alt="" width="928" height="400" srcset="https://www.privacyidea.org/wp-content/uploads/2017/11/privacyidea-token-janitor.png 928w, https://www.privacyidea.org/wp-content/uploads/2017/11/privacyidea-token-janitor-300x129.png 300w, https://www.privacyidea.org/wp-content/uploads/2017/11/privacyidea-token-janitor-768x331.png 768w" sizes="auto, (max-width: 928px) 100vw, 928px" /></a></p>
<p>This way the administrator can use the tokeninfo field to mark tokens and e.g. delete all marked tokens. The condition can also be a timestamp in the tokeninfo field. Actions can also be to disable or enable a token or only to mark this token (in the tokeninfo field).</p>
<p>&nbsp;</p>
<p>If you thought privacyIDEA is cool &#8211; you may realize you were wrong.</p>
<p>privacyIDEA is extremely cool!</p>
<p>So use it! &#8211; share your ideas at the <a href="https://community.privacyidea.org" target="_blank" rel="noopener">community</a> or enlighten use with your <a href="https://github.com/privacyidea/privacyidea" target="_blank" rel="noopener">pull request at github</a>!</p>
<p>If you also want to be cool &#8211; you may also <a href="https://netknights.it/en/unternehmen/job-offers/" target="_blank" rel="noopener">apply for a job at the cool guys!</a> <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Most flexible two factor authentication &#8211; handling your events!</title>
		<link>https://www.privacyidea.org/most-flexible-two-factor-authentication-handling-your-events/</link>
		
		<dc:creator><![CDATA[Cornelius Kölbel]]></dc:creator>
		<pubDate>Wed, 19 Jul 2017 12:19:06 +0000</pubDate>
				<category><![CDATA[documentation]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Event Handler]]></category>
		<category><![CDATA[notification]]></category>
		<category><![CDATA[Policy]]></category>
		<guid isPermaLink="false">https://www.privacyidea.org/?p=1241</guid>

					<description><![CDATA[privacyIDEA comes with a great feature: The event handling framework. So learn more about the unlimited power of the event handling framework and how to use its flexibility to get a privacyIDEA setup, which fits your needs. Event Handling Framework When speaking of software or products the term &#8220;framework&#8221; might raise a connotation of &#8220;you have [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>privacyIDEA comes with a great feature: The <strong>event handling framework</strong>.</p>
<p>So learn more about the unlimited power of the event handling framework and how to use its flexibility to get a privacyIDEA setup, which fits your needs.</p>
<h2>Event Handling Framework</h2>
<p>When speaking of software or products the term &#8220;framework&#8221; might raise a connotation of &#8220;you have to do it yourself&#8221;, &#8220;things are not ready&#8221;, &#8220;the software is not usable&#8221;.</p>
<p>A javascript framework can help you to develop cool web front ends. A python framework can be the basis for developing microservices and the framework Qt still requires the developer to develop the real program with the business logic.</p>
<p>When speaking of the Event Handling Framework things might similar: We the developer do not know how you want to use privacyIDEA and thus we give you the biggest flexibility. We have not thought of all possibilities in which you &#8211; the administrator &#8211; could use this framework! So you can come up with usage scenarios or configuration combinations <strong>noone has ever seen before</strong>!</p>
<p>But when speaking of the Event Handling Framework things are a bit different: You do not have to be a developer to solve your ideas or have privacyIDEA run the way you want it to.</p>
<p>Using the Event Handling Framework you can get the highest flexibility out of a state of the art authentication server, just by easily configuring rules in an easy web interface.</p>
<h2>The basic concept of Event Handlers</h2>
<p><figure id="attachment_1249" aria-describedby="caption-attachment-1249" style="width: 612px" class="wp-caption aligncenter"><a href="https://www.privacyidea.org/wp-content/uploads/2017/07/event-handler-overview.png"><img loading="lazy" decoding="async" class="wp-image-1249" src="https://www.privacyidea.org/wp-content/uploads/2017/07/event-handler-overview-300x152.png" alt="" width="612" height="310" srcset="https://www.privacyidea.org/wp-content/uploads/2017/07/event-handler-overview-300x152.png 300w, https://www.privacyidea.org/wp-content/uploads/2017/07/event-handler-overview-768x389.png 768w, https://www.privacyidea.org/wp-content/uploads/2017/07/event-handler-overview-1024x519.png 1024w, https://www.privacyidea.org/wp-content/uploads/2017/07/event-handler-overview.png 1281w" sizes="auto, (max-width: 612px) 100vw, 612px" /></a><figcaption id="caption-attachment-1249" class="wp-caption-text">The list of event handling definitions</figcaption></figure></p>
<h3>A top level view</h3>
<p>Each API request is an event:</p>
<ul>
<li>An authentication request,</li>
<li>the request to issue a token,</li>
<li>to block a token</li>
<li>or unassign a token.</li>
<li>If a user logs in to the Web UI, this is an API request&#8230;</li>
</ul>
<p>You can see the <a href="http://privacyidea.readthedocs.io/en/latest/modules/api.html" target="_blank" rel="noopener noreferrer">full list of all API calls here</a>.</p>
<p>The Event Handling Framework allows the administrator to &#8220;attach&#8221; new actions to each and every API call/event. It roughly works like this:</p>
<p style="padding-left: 30px;">event -&gt; condition -&gt; action</p>
<h3>Conditions</h3>
<p>But these actions are only triggered in case a list of <strong>conditions</strong> evaluate to <em>true</em>.  Conditions can be:</p>
<ul>
<li>if an authentication request was successful,</li>
<li>if the role of the user in the request was &#8220;administrator&#8221; or &#8220;user&#8221;,</li>
<li>if the token used was of a certain type</li>
<li>but also more complex conditions like if a date contained in a tokeninfo field of the used token is before or after a certain timestamp or of a certain age.</li>
</ul>
<p>There are currently 14 different, sometimes rather complex conditions and the number is growing.  For a <a href="http://privacyidea.readthedocs.io/en/latest/eventhandler/index.html#conditions" target="_blank" rel="noopener noreferrer">full list of conditions see the online documentation</a>.</p>
<h3>Actions &#8211; The Event Handlers</h3>
<p>Actions are performed by the event handlers. Currently there are three &#8220;groups&#8221;: Notifications, Token actions and scripts.</p>
<p>Roughly speaking the <em>Notification</em> actions will automatically notify administrators or users in case of certain events and if certain conditions apply. Notification can be done via email or SMS.</p>
<p>The administrator can also define that <em>Token actions</em> will happen. These are roughly all actions on tokens you can think of: enable, disable, set description and validity period, set abitrary tokeninfo fields, delete tokens and even enroll new tokens! This is probably the most important handler for automating tasks which e.g. can help large organizations with enrollment processes.</p>
<p>Finally there is the <em>Script Handler</em>, which can trigger shell scripts. The privacyIDEA administrator can write and define any number of shell scripts and thus gets unlimited possibilities. The usual use case we think about might be running backups or cleaning up orphaned tokens. But you will have probably a lot of other ideas.</p>
<p><figure id="attachment_1251" aria-describedby="caption-attachment-1251" style="width: 557px" class="wp-caption aligncenter"><a href="https://www.privacyidea.org/wp-content/uploads/2017/07/event-details.png"><img loading="lazy" decoding="async" class=" wp-image-1251" src="https://www.privacyidea.org/wp-content/uploads/2017/07/event-details-300x169.png" alt="" width="557" height="314" srcset="https://www.privacyidea.org/wp-content/uploads/2017/07/event-details-300x169.png 300w, https://www.privacyidea.org/wp-content/uploads/2017/07/event-details-768x433.png 768w, https://www.privacyidea.org/wp-content/uploads/2017/07/event-details.png 918w" sizes="auto, (max-width: 557px) 100vw, 557px" /></a><figcaption id="caption-attachment-1251" class="wp-caption-text">The action &#8220;set description&#8221; defined in a token event. During enrollment the description of the token gets set to &#8220;This token needs to be shipped 2017-07-10T10:00+0200&#8221;.</figcaption></figure></p>
<h2>Examples</h2>
<p>Some of these examples might occur to you a bit far fetched. But after all these are examples of what is possible. So you may come up with your own scenarios which very probably will also work out nicely.</p>
<h3>Notify the user in case his password is breached</h3>
<p>The notification event handler can send an email or an SMS to the user, if &#8220;he&#8221; fails to authenticate. This way the user knows, if someone else tried to authenticate.</p>
<p>This can be combined with the condition of the <em>tokentype</em>. The tokentype is only known (and thus only the event handler will trigger) if the OTP PIN a.k.a. static password of the user is correct. Thus the user gets notified if someone guessed or sniffed his static password but fails at the second factor.</p>
<p><figure id="attachment_1258" aria-describedby="caption-attachment-1258" style="width: 537px" class="wp-caption aligncenter"><a href="https://www.privacyidea.org/wp-content/uploads/2017/07/tokentype-definition.png"><img loading="lazy" decoding="async" class=" wp-image-1258" src="https://www.privacyidea.org/wp-content/uploads/2017/07/tokentype-definition-300x119.png" alt="" width="537" height="213" srcset="https://www.privacyidea.org/wp-content/uploads/2017/07/tokentype-definition-300x119.png 300w, https://www.privacyidea.org/wp-content/uploads/2017/07/tokentype-definition-768x304.png 768w, https://www.privacyidea.org/wp-content/uploads/2017/07/tokentype-definition.png 973w" sizes="auto, (max-width: 537px) 100vw, 537px" /></a><figcaption id="caption-attachment-1258" class="wp-caption-text">The condition contains the tokentype. The event will only trigger if the used token is an HOTP or TOTP token.</figcaption></figure></p>
<h3>Limit token usage</h3>
<p>If for any reason you need a token, that the user is only allowed to use for a limited time. E.g. the user would only be allowed to login 100 times.</p>
<p>You can create an event handler definition in the token handler to disable the token, if it either was successfully used more than 100 times or it was unsuccessfully used more than 50 times. (To whoever this may concern).</p>
<p><figure id="attachment_1259" aria-describedby="caption-attachment-1259" style="width: 542px" class="wp-caption aligncenter"><a href="https://www.privacyidea.org/wp-content/uploads/2017/07/disable-token.png"><img loading="lazy" decoding="async" class=" wp-image-1259" src="https://www.privacyidea.org/wp-content/uploads/2017/07/disable-token-300x154.png" alt="" width="542" height="278" srcset="https://www.privacyidea.org/wp-content/uploads/2017/07/disable-token-300x154.png 300w, https://www.privacyidea.org/wp-content/uploads/2017/07/disable-token-768x393.png 768w, https://www.privacyidea.org/wp-content/uploads/2017/07/disable-token.png 992w" sizes="auto, (max-width: 542px) 100vw, 542px" /></a><figcaption id="caption-attachment-1259" class="wp-caption-text">Disable a token, that was used too often.</figcaption></figure></p>
<h3>Automatically Unlock locked tokens</h3>
<p>Starting with privacyIDEA 2.20 (currently under development) you can also use timestamp tags in the tokeninfo condition and settings. I.e. if one event occurs, the token event handler can use the &#8220;set tokeninfo&#8221; to set additional information like <strong>tokeninfo key=locked</strong> and <strong>tokeninfo value={now}</strong>. The tag &#8220;now&#8221; will be converted to the current timestamp. This action could be called on a failed authentication request. You could also mark the token for any other reason.</p>
<p><figure id="attachment_1260" aria-describedby="caption-attachment-1260" style="width: 600px" class="wp-caption aligncenter"><a href="https://www.privacyidea.org/wp-content/uploads/2017/07/mark-the-token.png"><img loading="lazy" decoding="async" class="wp-image-1260" src="https://www.privacyidea.org/wp-content/uploads/2017/07/mark-the-token-300x162.png" alt="" width="600" height="324" srcset="https://www.privacyidea.org/wp-content/uploads/2017/07/mark-the-token-300x162.png 300w, https://www.privacyidea.org/wp-content/uploads/2017/07/mark-the-token-768x415.png 768w, https://www.privacyidea.org/wp-content/uploads/2017/07/mark-the-token.png 968w" sizes="auto, (max-width: 600px) 100vw, 600px" /></a><figcaption id="caption-attachment-1260" class="wp-caption-text">Mark the token with the current timestamp.</figcaption></figure></p>
<p>A second event handler can check for this timestamp. I.e. the condition can verify if the timestamp is past &#8211; lets say &#8211; one week/7 days. In this case a second action like unlocking the token can be performed.</p>
<p><figure id="attachment_1261" aria-describedby="caption-attachment-1261" style="width: 600px" class="wp-caption aligncenter"><a href="https://www.privacyidea.org/wp-content/uploads/2017/07/tokeninfo-conditions.png"><img loading="lazy" decoding="async" class="wp-image-1261" src="https://www.privacyidea.org/wp-content/uploads/2017/07/tokeninfo-conditions-300x54.png" alt="" width="600" height="108" srcset="https://www.privacyidea.org/wp-content/uploads/2017/07/tokeninfo-conditions-300x54.png 300w, https://www.privacyidea.org/wp-content/uploads/2017/07/tokeninfo-conditions-768x139.png 768w, https://www.privacyidea.org/wp-content/uploads/2017/07/tokeninfo-conditions.png 970w" sizes="auto, (max-width: 600px) 100vw, 600px" /></a><figcaption id="caption-attachment-1261" class="wp-caption-text">Check if the locked timestamp is newer than 7 days old.</figcaption></figure></p>
<p>This can be achieved by using the <em>tokeninfo</em> condition. This check can also check strings, integers and dates for being less, equal or greater. This helps to easily automate many tedious tasks.</p>
<h2>Under the hood</h2>
<p>The online documentation should <a href="http://privacyidea.readthedocs.io/en/latest/eventhandler/index.html" target="_blank" rel="noopener noreferrer">contain the full developer view of the event handlers</a>.</p>
<h3>Decorators</h3>
<p>privacyIDEA is based on the python framework Flask and uses a lot of decorators to structure code, reduce lines of code and improve testability. The event handler adds one decorator &#8220;@event&#8221;. E.g. this <a href="https://github.com/privacyidea/privacyidea/blob/master/privacyidea/api/validate.py#L176" target="_blank" rel="noopener noreferrer">decorator decorates the endpoint &#8220;/validate/check&#8221;</a>.</p>
<p>The decorator takes care of registering this endpoint in the event handler framework but also calling possible actions.</p>
<h3>Event Handler Class</h3>
<p>Each event handler (<a href="http://privacyidea.readthedocs.io/en/latest/eventhandler/usernotification.html" target="_blank" rel="noopener noreferrer">Notification</a>, <a href="http://privacyidea.readthedocs.io/en/latest/eventhandler/tokenhandler.html" target="_blank" rel="noopener noreferrer">Token Handler</a>, <a href="http://privacyidea.readthedocs.io/en/latest/eventhandler/scripthandler.html" target="_blank" rel="noopener noreferrer">Scripts</a>) is a python Class, that inherits from the Base Handler. Each handler could define its own conditions and its own actions and thus can work self-contained and add any functionality to privacyIDEA.</p>
<h3>Do actions</h3>
<p>As the event handler like the Token Event Handler use already existing code for diabling or enrolling tokens, these eventhandlers are relatively small and stable. E.g. the token event handler is roughly 100 lines of code defining the allowed actions and another 100 lines of code for calling existing lower level functions.</p>
<p>This is done in the main function &#8220;<a href="https://github.com/privacyidea/privacyidea/blob/master/privacyidea/lib/eventhandler/tokenhandler.py#L211" target="_blank" rel="noopener noreferrer">do</a>&#8221; of the event handler.</p>
<h3>Conditions</h3>
<p>Each event handler could also define its own conditions, if this is necessary or makes sense. But for now all conditions are the same for all event handlers and thus only the base event handler class implements the method &#8220;<a href="https://github.com/privacyidea/privacyidea/blob/master/privacyidea/lib/eventhandler/base.py#L245" target="_blank" rel="noopener noreferrer">check_conditions</a>&#8220;.</p>
<h2>Finally</h2>
<p><figure id="attachment_1255" aria-describedby="caption-attachment-1255" style="width: 518px" class="wp-caption aligncenter"><a href="https://www.privacyidea.org/wp-content/uploads/2017/07/stairs-1036882_1280.jpg"><img loading="lazy" decoding="async" class="wp-image-1255" src="https://www.privacyidea.org/wp-content/uploads/2017/07/stairs-1036882_1280-300x200.jpg" alt="" width="518" height="345" srcset="https://www.privacyidea.org/wp-content/uploads/2017/07/stairs-1036882_1280-300x200.jpg 300w, https://www.privacyidea.org/wp-content/uploads/2017/07/stairs-1036882_1280-768x512.jpg 768w, https://www.privacyidea.org/wp-content/uploads/2017/07/stairs-1036882_1280-1024x682.jpg 1024w, https://www.privacyidea.org/wp-content/uploads/2017/07/stairs-1036882_1280.jpg 1280w" sizes="auto, (max-width: 518px) 100vw, 518px" /></a><figcaption id="caption-attachment-1255" class="wp-caption-text">Your imagination!</figcaption></figure></p>
<p>Adding event handler definitions is a matter of a few clicks for the administrator. But it is a great step for the automation of your privacyIDEA installation.</p>
<p>Adding a new event handler class is also only a matter of inheriting the base handler class and starting with woughly 50 lines of code. The hardest thing is to come up with a new idea! But the only limit is your imagination!</p>
<h2></h2>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>2FA Workshop at tuebix</title>
		<link>https://www.privacyidea.org/2fa-workshop-tuebix/</link>
		
		<dc:creator><![CDATA[Cornelius Kölbel]]></dc:creator>
		<pubDate>Thu, 22 Jun 2017 10:14:51 +0000</pubDate>
				<category><![CDATA[documentation]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[LDAP]]></category>
		<category><![CDATA[ownCloud]]></category>
		<category><![CDATA[talk]]></category>
		<category><![CDATA[Univention Corporate Server]]></category>
		<guid isPermaLink="false">https://www.privacyidea.org/?p=1226</guid>

					<description><![CDATA[We are at Tübix 2017 and doing a workshop about adding a 2nd Factor to your applications. If you can not attend or if you want to try this at home afterwards, here is what we will do! Setup 10.0.2.201 ucs.tuebix.intranet (LDAP) Univention Corporate Server 4.2 10.0.2.202 privacyidea.tuebix.intranet, Ubuntu 16.04 LTS 10.0.2.203 wordpress.tuebix.intranet, Ubuntu 16.04 LTS [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>We are at <a href="http://www.tuebix.org/2017/programm/cornelius-koelbel-mehr-faktor-authentifizierung-nicht-nur-fuer-die-eigene-cloud/" target="_blank" rel="noopener noreferrer">Tübix 2017</a> and doing a workshop about adding a 2nd Factor to your applications.</p>
<p>If you can not attend or if you want to try this at home afterwards, here is what we will do!</p>
<h2>Setup</h2>
<p>10.0.2.201 ucs.tuebix.intranet (LDAP) Univention Corporate Server 4.2<br />
10.0.2.202 privacyidea.tuebix.intranet, Ubuntu 16.04 LTS<br />
10.0.2.203 wordpress.tuebix.intranet, Ubuntu 16.04 LTS with latest wordpress<br />
10.0.2.204 owncloud.tuebix.intranet, Ubuntu 16.04 LTS with ownCloud 10</p>
<h3>LDAP</h3>
<p>BaseDN: cn=users,dc=tuebix,dc=intranet</p>
<p>The UCS has the following users:</p>
<ul>
<li>admininistrator</li>
<li>user1</li>
<li>user2</li>
<li>user3</li>
</ul>
<h3>ownCloud</h3>
<p>ownCloud is connected via LDAP, so the LDAP users can connect to ownCloud.</p>
<p>The ownCloud Administrator is called: admin</p>
<h3>WordPress</h3>
<p>WordPress only has internal users. Nevertheless the user are also called:</p>
<ul>
<li>administrator</li>
<li>user1</li>
<li>user2</li>
<li>user3</li>
</ul>
<h2>What we will do &#8211; our Agenda</h2>
<ul>
<li>We will install privacyIDEA and connect privacyIDEA to the UCS, so that privacyIDEA knows the users from the LDAP directory</li>
<li>Then we will enroll different kind of tokens to the users.
<ul>
<li>The administrator can enroll a token for the users but</li>
<li>users can also login to the webui with their LDAP password an enroll a token for themselves.</li>
</ul>
</li>
<li>Then we start connecting <strong>applications</strong> to privacyIDEA to add <strong>2FA</strong> to the <strong>applications</strong>
<ul>
<li>WordPress with &#8220;strong authentication&#8221; plugin</li>
<li>ownCloud with the &#8220;privacyIDEA ownCloud App&#8221; from the market place</li>
<li>SSH login with 2FA for users user1, user2, user3</li>
</ul>
</li>
</ul>
<h2>privacyIDEA</h2>
<h3>Install</h3>
<p>privacyIDEA can be <a href="http://privacyidea.readthedocs.io/en/latest/installation/ubuntu.html" target="_blank" rel="noopener noreferrer">installed</a> in many different ways on different Linux distributions. We will install privacyIDEA on our Ubuntu 16.04 machine 10.0.2.202.</p>
<p>As root:</p>
<pre>add-apt-repository ppa:privacyidea/privacyidea

apt update

apt install privacyidea-apache2</pre>
<p>privacyidea-apache2 is a meta package which will install MySQL, Apache and set up privacyIDEA. Finally we only need to create the first token administrator.</p>
<pre>pi-manage add admin super</pre>
<p>Now we have an administrator called &#8220;super&#8221;</p>
<h3>Configure</h3>
<p>privacyIDEA can be configured via command line, API or the web UI.</p>
<p><a href="https://10.0.2.202" target="_blank" rel="noopener noreferrer">https://10.0.2.202</a></p>
<p>We need to configure the Resolver <strong>tuebix_users</strong> as Active Directory. For this we need to fetch the certificate of the UCS server.</p>
<ul>
<li>LDAP Resolver to ldaps://ucs.tuebix.intranet</li>
<li>Base DN cn=users,dc=tuebix,dc=intranet</li>
<li>Bind DN cn=administrator,cn=users,dc=tuebix,dc=intranet</li>
<li>Preset AD</li>
</ul>
<p>And a Realm <strong>tuebix</strong> with the resolver <strong>tuebix_users</strong>.</p>
<p>We can also take a look at the policies and configure a policy to use otppin=userstore.</p>
<h3>Enroll tokens</h3>
<p>Enroll tokens as administrator and as normal user&#8230;</p>
<ul>
<li>Enroll Smartphone App</li>
<li>Yubikey</li>
<li>U2F Token</li>
<li>Feitian C200 (import File Feitian.csv)</li>
</ul>
<h2>ownCloud with 2FA</h2>
<p>For ownCloud X we login as administrator and install the &#8220;privacyIDEA ownCloud App&#8221; from the Marketplace.</p>
<p>We need to configure the App against privacyIDEA:</p>
<ul>
<li>https://privacyidea.tuebix.intranet</li>
<li>no realm</li>
<li>no ssl check</li>
</ul>
<p><strong>Note:</strong> The privacyIDEA ownCloud App will authenticate <strong>all</strong> users with a 2nd factor!</p>
<p>After this, users need to present a 2nd factor against privacyIDEA when they log in.</p>
<h2>WordPress with 2FA</h2>
<p>Install the &#8220;strong authentication&#8221; plugin.</p>
<p>We need to configure the Plugin against privacyIDEA:</p>
<ul>
<li>https://privacyidea.tuebix.intranet&#8230;</li>
</ul>
<p><strong>Note:</strong> Users need to enter both factors in the password field at the same time.</p>
<p>The WordPress plugin authenticates users <strong>only</strong> against privacyIDEA; while with ownCloud users are authenticated by ownCloud and by privacyIDEA.</p>
<h2>SSH with 2FA</h2>
<p>On either owncloud machine or wordpress machine we install the privacyIDEA PAM module:</p>
<pre>add-apt-repository ppa:privacyidea/privacyidea

apt update

apt install privacyidea-pam</pre>
<p>&#8230;and configure it accordingly against https://privacyidea.tuebix.intranet.</p>
<p><strong>Note</strong>: Users need to match!</p>
<h2>privacyIDEA LDAP Proxy</h2>
<p>Bonus!</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>privacyIDEA Authentication Server on ready made KVM image</title>
		<link>https://www.privacyidea.org/privacyidea-authentication-server-ready-made-kvm-image/</link>
		
		<dc:creator><![CDATA[Cornelius Kölbel]]></dc:creator>
		<pubDate>Mon, 08 May 2017 07:47:57 +0000</pubDate>
				<category><![CDATA[documentation]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[Installation]]></category>
		<guid isPermaLink="false">https://www.privacyidea.org/?p=1194</guid>

					<description><![CDATA[We provide a ready made image to get your test system up and running even faster. This is a KVM image based on Ubuntu 16.04 LTS and privacyIDEA 2.17. Download and create VM Download the privacyIDEA image. This is a ready installed privacyIDEA Authentication Server on a Ubuntu 16.04 LTS system. The qcow image is [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>We provide a ready made image to get your test system up and running even faster. This is a KVM image based on Ubuntu 16.04 LTS and privacyIDEA 2.17.</p>
<h2>Download and create VM</h2>
<p>Download the <a href="https://lancelot.netknights.it/owncloud/s/AsPXSevx4xS9wsP" target="_blank">privacyIDEA image</a>. This is a ready installed privacyIDEA Authentication Server on a Ubuntu 16.04 LTS system. The qcow image is supposed to run in KVM.</p>
<p>First you need to unpack the image:</p>
<pre>lzma -d privacyidea-template-1604.qcow2.lzma</pre>
<p>Now you can create a new Linux virtual machine version &#8220;Ubuntu 16.04&#8221; with this very image as hard disk and you can boot the machine.</p>
<h2>Configure and getting started</h2>
<p>You can login using the root account with the password &#8220;privacyidea&#8221;.</p>
<p>The ethernet interface is configured as DHCP, so the machine might like your network directly. OpenSSH is installed, so that you can also login remotely.</p>
<p>privacyIDEA is installed with the Apache2 Webserver.</p>
<p>You probably should reset the root password! Here are further necessary steps you might want to take:</p>
<pre>apt update

apt upgrade</pre>
<p>Then you should reset the password of the token administrator &#8220;super&#8221;:</p>
<pre>pi-manage admin add super</pre>
<p>Now you can login at the WebUI and start configure user sources and enrolling tokens.</p>
<blockquote><p>This is a demo version with pregenerated keys! You should NEVER use this system in productive environment!</p></blockquote>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Add two factor authentication to your web application</title>
		<link>https://www.privacyidea.org/add-two-factor-authentication-web-application/</link>
		
		<dc:creator><![CDATA[Cornelius Kölbel]]></dc:creator>
		<pubDate>Sun, 15 Jan 2017 12:46:05 +0000</pubDate>
				<category><![CDATA[documentation]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Integration]]></category>
		<category><![CDATA[login]]></category>
		<guid isPermaLink="false">https://www.privacyidea.org/?p=1127</guid>

					<description><![CDATA[This blog article describes, how you can add two factor authentication to your web application using the authentication system privacyIDEA. Two factor authentication has been added this way to ownCloud/Nextcloud, OTRS, dokuwiki, WordPress, TYPO3, Django, Kopano (Zarafa) and SimpleSAMLphp. See the plugin section of the privacyIDEA online documentation. Two different concepts There are basically two [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a href="https://www.privacyidea.org/wp-content/uploads/2017/01/code-1839406_1280.jpg"><img loading="lazy" decoding="async" class="size-medium wp-image-1138 alignleft" src="https://www.privacyidea.org/wp-content/uploads/2017/01/code-1839406_1280-300x200.jpg" alt="" width="300" height="200" srcset="https://www.privacyidea.org/wp-content/uploads/2017/01/code-1839406_1280-300x200.jpg 300w, https://www.privacyidea.org/wp-content/uploads/2017/01/code-1839406_1280-768x512.jpg 768w, https://www.privacyidea.org/wp-content/uploads/2017/01/code-1839406_1280-1024x683.jpg 1024w, https://www.privacyidea.org/wp-content/uploads/2017/01/code-1839406_1280.jpg 1280w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a>This blog article describes, how you can add two factor authentication to your web application using the authentication system privacyIDEA.</p>
<p>Two factor authentication has been added this way to ownCloud/Nextcloud, OTRS, dokuwiki, WordPress, TYPO3, Django, Kopano (Zarafa) and SimpleSAMLphp. See the <a href="http://privacyidea.readthedocs.io/en/latest/application_plugins/index.html" target="_blank">plugin section of the privacyIDEA online documentation</a>.</p>
<h2>Two different concepts</h2>
<p>There are basically two ways for the user to provide a second factor during authentication. The first one is to completely replace the authentication of your webapplication. In this case your application delegates the complete authentication process to privacyIDEA. This is implemented e.g. in the <a href="https://github.com/privacyidea/privacyidea/tree/master/authmodules/OTRS" target="_blank">OTRS plugin</a> and the <a href="https://github.com/privacyidea/wordpress-strong-authentication" target="_blank">WordPress plugin</a>. In this case the plugin will take care of the first <em>and</em> second factor. And in certain cases it will also take care of the WebUI Login Screen.</p>
<p>The other possiblity is that your application uses its normal password based authentication, but after the user has successfully authenticated with his usual username and the application password, your application decides, not to immediately allow access, but hand over the authentication to the 2FA plugin, which will take care of quering the second factor. This is implemented in the <a href="https://github.com/NetKnights-GmbH/privacyidea-owncloud-app" target="_blank">privacyIDEA ownCloud App</a>.</p>
<p>In addition we already published some <a href="https://github.com/privacyidea/AuthModuleRequirements" target="_blank">basic requirements for <em>modular</em> two factor authentication</a> in a web application.</p>
<h3>Hand complete authentication process to the 2FA plugin</h3>
<p>Your application should allow to register or configure a 3rd party module or class. This class would have to provide a method like <em>authenticate_user</em> for verifying the users input. The easiest way would be, that such a plugin does not even has to change or bring its own login screen. In such simple case, the authentication method <em>authenticate_user</em> would simple receive the credentials, that were entered at your applications default login screen. It then would return True or False or maybe raise an exception.</p>
<p>The privacyIDEA plugin for your webapplication would use this username and this password to issue a call to the privacyIDEA REST API. The plugin would call the <a href="http://privacyidea.readthedocs.io/en/latest/modules/api/validate.html#post--validate-check" target="_blank">/validate/check</a> endpoint with <em>username</em> and <em>password</em> as parameters and simply evaluate the JSON response.</p>
<p>Managing users, returning user attributes or listing users would be out of scope of such an authentication plugin. Authorization would be out of scope, just as it is with the Unix PAM stack.</p>
<h4>Example OTRS</h4>
<p>An example implementation of the complete authentication replacement is the OTRS plugin for privacyIDEA.</p>
<p>In this case the administrator can configure in OTRS which Perl module should be used for authenticating the user. <strong>Note</strong>: Not for verifying if the user exists and not for fetching attributes like given name or email address of the user.</p>
<p>The Perl module has to provide a function <em>Auth</em>, which takes a dictionary/hash with the keys <em>User</em> and <em>Pw</em>. If the credentials were verified successfully this function returns the Username of the user, otherwise an empty string.</p>
<p><a href="https://github.com/privacyidea/privacyidea/blob/master/authmodules/OTRS/privacyIDEA-4_0.pm#L86" target="_blank">See the implementation at github</a>.</p>
<p>In this case, privacyIDEA takes care of verifying two factors. The user has entered a knowledge and a One Time Password (2nd factor: possession) into the password field. privacyIDEA knows how to verify the static password (knowledge) and the OTP value.</p>
<h4>Example WordPress</h4>
<p>The WordPress plugin works the same. It does not modify the login screen, as this is not necessary. The user enters his static password and his one time password in the password field. The WordPress plugin registers or overwrites the function <a href="https://github.com/privacyidea/wordpress-strong-authentication/blob/master/strong-authentication.php#L236" target="_blank">wp_authenticate</a>, which takes the credentials that were entered by the user. WordPress relies on the return value of this function, which again is either a WordPress User object or null.</p>
<p>Within this function of the plugin, the credentials are verified against the configured privacyIDEA server. In this case this is done using <a href="https://github.com/privacyidea/wordpress-strong-authentication/blob/master/strong-authentication.php#L63" target="_blank">curl</a>.</p>
<p><strong>Note</strong>: All authentication requests are forwarded to privacyIDEA. WordPress does not know if the user has a second factor or not. It does not know, which kind of second factor a user has. This is all handled by privacyIDEA. This way the plugin can be kept rather light weight.</p>
<h3>Only hand second factor to the 2FA plugin</h3>
<p>Instead of passing the complete authentication process to the 3rd party plugin, you can also design your authentication framework this way, that your application still verifies the static user password and request an additional authentication on top.</p>
<p>This can be interesting, if your application needs to know the user password, since it is used to contact email servers or encrypt data.</p>
<p>Your application will verify the password as before. But in addition it will pass the controll the the 2FA plugin</p>
<h4>Example ownCloud</h4>
<p>The ownCloud 2FA Framework is implemented this way.</p>
<p>In the first step the user has to authenticate against ownCloud with the ownCloud password.</p>
<p><figure id="attachment_1134" aria-describedby="caption-attachment-1134" style="width: 300px" class="wp-caption alignnone"><a href="https://www.privacyidea.org/wp-content/uploads/2017/01/owncloud-first-factor.png"><img loading="lazy" decoding="async" class="wp-image-1134 size-medium" src="https://www.privacyidea.org/wp-content/uploads/2017/01/owncloud-first-factor-300x264.png" width="300" height="264" srcset="https://www.privacyidea.org/wp-content/uploads/2017/01/owncloud-first-factor-300x264.png 300w, https://www.privacyidea.org/wp-content/uploads/2017/01/owncloud-first-factor.png 524w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><figcaption id="caption-attachment-1134" class="wp-caption-text">User authenticates with his normal ownCloud password.</figcaption></figure></p>
<p>If the user entered the correct password, which is still verified by ownCloud, the web application (ownCloud) calls the 2FA plugin to ask for the second factor.</p>
<p><figure id="attachment_1135" aria-describedby="caption-attachment-1135" style="width: 297px" class="wp-caption alignnone"><a href="https://www.privacyidea.org/wp-content/uploads/2017/01/owncloud-second-factor.png"><img loading="lazy" decoding="async" class="wp-image-1135 size-medium" src="https://www.privacyidea.org/wp-content/uploads/2017/01/owncloud-second-factor-297x300.png" width="297" height="300" srcset="https://www.privacyidea.org/wp-content/uploads/2017/01/owncloud-second-factor-297x300.png 297w, https://www.privacyidea.org/wp-content/uploads/2017/01/owncloud-second-factor.png 481w" sizes="auto, (max-width: 297px) 100vw, 297px" /></a><figcaption id="caption-attachment-1135" class="wp-caption-text">If the user entered the correct static ownCloud password, he is asked for the second factor.</figcaption></figure></p>
<p>The ownCloud 2FA framework requires the plugin to register a Class that is <a href="https://github.com/NetKnights-GmbH/privacyidea-owncloud-app/blob/master/twofactor_privacyidea/lib/Provider/TwoFactorPrivacyIDEAProvider.php#L34" target="_blank">derived from a certain 2FA base class</a>. This way the web application (ownCloud) knows, if two factor authentication can be used for the user, who is already authenticated in the first step.</p>
<p>The 2FA framework then asks the plugin/class to <a href="https://github.com/NetKnights-GmbH/privacyidea-owncloud-app/blob/master/twofactor_privacyidea/lib/Provider/TwoFactorPrivacyIDEAProvider.php#L81" target="_blank">provide a template for the 2nd step of the Login UI</a>. Finally the 2FA framework calls a <a href="https://github.com/NetKnights-GmbH/privacyidea-owncloud-app/blob/master/twofactor_privacyidea/lib/Provider/TwoFactorPrivacyIDEAProvider.php#L93" target="_blank">class method in the plugin to verify the 2nd factor</a>.</p>
<p>This good thing about it is, that ownCloud can know the user&#8217;s password and thus use the user&#8217;s for encryption and sending emails. The drawback of this design is, that the authentication workflow might be a bit more complicated, exspecially if it comes to special scenarios like challenge response authentication.</p>
<h2>Special case for Challenge Response token like SMS and Email</h2>
<p>Although <a href="https://netknights.it/en/lasting-two-factor-authentication-with-privacyidea/" target="_blank">NIST recommended to not use SMS for two factor authentication</a> it is still an attractive and easy way. In addition privacyIDEA can run any combination of authentication devices. Some users may use Yubikeys, others Google Authenticators, some users use key fob tokens and another group could use SMS.</p>
<p>But privacyIDEA needs additional information to trigger an SMS. Not everybody can trigger the sending of an SMS, otherwise the user would get spammed with SMS on his mobile phone.</p>
<p>There are two ways to trigger and SMS:</p>
<ol>
<li>The user authenticates with his OTP PIN (static password). privacyIDEA realizes, that this is the correct password for an SMS token and will send the SMS.</li>
<li>An administrative or system account requests the sending of an SMS for this specific user.</li>
</ol>
<p>In both cases the 2FA framework of your application has to provide the possibility to issue a REST request before the user authenticats. Because this first REST request will send the user the code, which he then can use to finally authenticate.</p>
<p>Most applications do not allow this easily today.</p>
<p>There is a beta implementation for the ownCloud 2FA framework, which is not that perfect. The <a href="https://github.com/NetKnights-GmbH/privacyidea-owncloud-app/blob/challenge-response/twofactor_privacyidea/lib/Provider/TwoFactorPrivacyIDEAProvider.php#L149" target="_blank">SMS is triggered when the Login UI is rendered</a>. This has the side effect that the SMS is triggered again, if the user entered a wrong OTP value, since the UI is rendered again.</p>
<p>When designing the authentication framework of your web applications, you could have such corner cases in mind.</p>
<h2>Now it is your turn!</h2>
<p>If you want to add 2FA to your web application, please contact us in our <a href="https://groups.google.com/forum/#!forum/privacyidea" target="_blank">Google Group</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Create your own user portal</title>
		<link>https://www.privacyidea.org/create-user-portal/</link>
					<comments>https://www.privacyidea.org/create-user-portal/#respond</comments>
		
		<dc:creator><![CDATA[Cornelius Kölbel]]></dc:creator>
		<pubDate>Tue, 01 Nov 2016 07:43:33 +0000</pubDate>
				<category><![CDATA[documentation]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Google Authenticator]]></category>
		<category><![CDATA[REST API]]></category>
		<guid isPermaLink="false">https://www.privacyidea.org/?p=1089</guid>

					<description><![CDATA[Sometimes it is important to add user self service functionalities to your own portal or create a stripped down version of the privacyIDEA user selfservice. You can strip down the rights for users in a very detailed manner using policies. You can also define an enrollment wizard policy, so that enrolling tokens gets even more [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Sometimes it is important to add user self service functionalities to your own portal or create a stripped down version of the privacyIDEA user selfservice. You can strip down the rights for users in a very detailed manner <a href="http://privacyidea.readthedocs.io/en/latest/policies/user.html" target="_blank">using policies</a>. You can also <a href="https://www.youtube.com/watch?v=diAGbsiG8_A" target="_blank">define an enrollment wizard policy</a>, so that enrolling tokens gets even more simpler. But sometimes even this is not enough.<a href="https://www.privacyidea.org/wp-content/uploads/2016/11/rest-api.png"><img loading="lazy" decoding="async" class=" wp-image-1090 alignright" src="https://www.privacyidea.org/wp-content/uploads/2016/11/rest-api-300x256.png" alt="rest-api" width="177" height="151" srcset="https://www.privacyidea.org/wp-content/uploads/2016/11/rest-api-300x256.png 300w, https://www.privacyidea.org/wp-content/uploads/2016/11/rest-api.png 649w" sizes="auto, (max-width: 177px) 100vw, 177px" /></a></p>
<h2>privacyIDEA REST API</h2>
<p>privacyIDEA provides a great and <a href="http://privacyidea.readthedocs.io/en/latest/modules/api.html" target="_blank">simple REST API</a> which lets you automate and integrate all tasks into other workflows. In fact the privacyIDEA Web UI as a single page application uses this REST API. Thus you could easily open the developer tools of your browser and monitor the HTTP requests that are sent.</p>
<h3>Authenticating a user</h3>
<p>A user needs to authenticate at the Web UI and also at the REST API. This is done by issuing the request</p>
<p><figure id="attachment_1092" aria-describedby="caption-attachment-1092" style="width: 152px" class="wp-caption alignright"><a href="https://www.privacyidea.org/wp-content/uploads/2016/11/auth-request.png"><img loading="lazy" decoding="async" class=" wp-image-1092" src="https://www.privacyidea.org/wp-content/uploads/2016/11/auth-request-300x215.png" alt="Auth-Request in the Chrome developer tools." width="152" height="109" srcset="https://www.privacyidea.org/wp-content/uploads/2016/11/auth-request-300x215.png 300w, https://www.privacyidea.org/wp-content/uploads/2016/11/auth-request.png 593w" sizes="auto, (max-width: 152px) 100vw, 152px" /></a><figcaption id="caption-attachment-1092" class="wp-caption-text">Auth-Request in the Chrome developer tools.</figcaption></figure></p>
<pre>POST /auth</pre>
<p><a href="http://privacyidea.readthedocs.io/en/latest/modules/api/auth.html#post--auth" target="_blank">The auth request</a> takes the username and the users password. Which password the user needs to provide, depends on the <em>login_mode</em> policy in the <em>WebUI</em> scope. The auth request returns an <em>authorization token</em> which needs to be added to each subsequent request.</p>
<p>You can also issue a test request using <em>httpie</em> from the command line like this:</p>
<pre>% http --verify no --pretty all --json POST https://localhost/auth username=secureuser password=test
/usr/lib/python2.7/dist-packages/urllib3/connectionpool.py:794: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
 InsecureRequestWarning)
HTTP/1.1 200 OK
Cache-Control: no-cache
Connection: keep-alive
Content-Length: 843
Content-Type: application/json
Date: Tue, 01 Nov 2016 07:28:55 GMT
Server: nginx/1.10.0 (Ubuntu)

{
 "id": 1, 
 "jsonrpc": "2.0", 
 "result": {
 "status": true, 
 "value": {
 "default_tokentype": "totp", 
 "log_level": 30, 
 "logout_time": 120, 
 "menus": [], 
 "policy_template_url": "https://raw.githubusercontent.com/privacyidea/policy-templates/master/templates/", 
 "realm": "secure", 
 "rights": [], 
 "role": "user", 
 "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InNlY3VyZXVzZXIiLCJub25jZSI6IjQyYjhhMWIzNDEzYTA5ZmQzMDljMDI3NzY3Mjc4N2I5MmFiNWI2ZWUiLCJhdXRodHlwZSI6InBhc3N3b3JkIiwicmVhbG0iOiJzZWN1cmUiLCJyaWdodHMiOltdLCJyb2xlIjoidXNlciIsImV4cCI6MTQ3Nzk4ODkzNX0.vCXNNV4Bmt2UuC0FMuc2qMbr8i_8zweROadvfLYcJzU", 
 "token_page_size": 15, 
 "token_wizard": false, 
 "token_wizard_2nd": false, 
 "user_details": false, 
 "user_page_size": 15, 
 "username": "secureuser"
 }
 }, 
 "time": 1477985335.376939, 
 "version": "privacyIDEA 2.16.dev3", 
 "versionnumber": "2.16.dev3"
}</pre>
<p>Using the authorization token</p>
<p>eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InNlY3VyZXVzZXIiLCJub25jZSI6IjQyYjhhMWIzNDEzYTA5ZmQzMDljMDI3NzY3Mjc4N2I5MmFiNWI2ZWUiLCJhdXRodHlwZSI6InBhc3N3b3JkIiwicmVhbG0iOiJzZWN1cmUiLCJyaWdodHMiOltdLCJyb2xlIjoidXNlciIsImV4cCI6MTQ3Nzk4ODkzNX0.vCXNNV4Bmt2UuC0FMuc2qMbr8i_8zweROadvfLYcJzU</p>
<p>for subsequent call.</p>
<h3>Enrolling a token</h3>
<p>Now the user can enroll a token using the <a href="http://privacyidea.readthedocs.io/en/latest/modules/api/token.html" target="_blank">token endpoints</a>. You need to issue a /token/init request.</p>
<p>To enroll an TOTP token the user would have to issue such a request:</p>
<pre>http --verify no --pretty all --json POST https://localhost/token/init \
     PI-Authorization:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InNlY3VyZXVzZXIiLCJub25jZSI6IjQyYjhhMWIzNDEzYTA5ZmQzMDljMDI3NzY3Mjc4N2I5MmFiNWI2ZWUiLCJhdXRodHlwZSI6InBhc3N3b3JkIiwicmVhbG0iOiJzZWN1cmUiLCJyaWdodHMiOltdLCJyb2xlIjoidXNlciIsImV4cCI6MTQ3Nzk4ODkzNX0.vCXNNV4Bmt2UuC0FMuc2qMbr8i_8zweROadvfLYcJzU \
     type=totp genkey=1 otplen=6</pre>
<p>The secret and also the image of the QR code to be scanned with a smartphone app is contained in the response:</p>
<pre> "googleurl": {
 "description": "URL for google Authenticator", 
 "img": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeoAAAHqAQAAAADjFjCXAAAD90lEQVR4nO2dTY6jSBBGXwxItQSpD+Cj4JuN6khzAziKbwBLS6CYRWaQ6epZGUaW218sEJR5SqUUiv+kzDkg019HaBAuXLhw4cKFCxd+Lm5ZWuzKZkw9MKVHsOtS7uLV63mrC/80HHd3Z3B397lx9xmgc2fwNd/Rxd0wN14R41vvXfir8SWbL7t2Kz4CTH3jDDczoHGGeTMAzKw9eXXhn4W3P559MrDh1q4M49Y6rC3DCA6Nw3Lq6sKFAzDMjee4rm/crkuLf/cAi9n/vrrwj8I7dx8JD+t+txzh7c41KSHg7uvJqwv/SHwyM7MeYGmx6/KVzBxAfvx7BmBLKeypqwv/MDwpVmmL+XTJhsxZNvPpsuKwpkfoHjtob7134a/Co3ISRZNUFxkBH2myig0zJIc7+Ir73KhyIvwMfDOzy4pdSSbNk66N3Yp/X1ZySWX5cqZ+k4cVfkCictKtLcM/X85kjdtwM5zubs7y5ZZeW3qM7m4++BbYW+9d+Kvw7GEh27XsTZObbTzZurHbXwEgpbnysMKflRLIAdERG2bIHTEeumSlVaa4TvjzEtkElGZsJBeNl/ShqKMXkdYJfx7374t71X2YerArAMuXA1tqxuYGrfqwwo9JMVwM1SVGAKqSyhxhXlVheeu9C38V/pA5QK7I5fQh+9pcQ2FXPVSvE35IstZ1/ptUypWS26yYOcyT1gl/WrL+zECaZeo8HGlys8XDQsk1ZOuEH5Bi61Idboy54VC9ukFWzJy0TvgBiSrx7j4jrsuXsH/p5fyoep3wQ1JZsxLN7XoVZeH9h4j1pHXCD0j4y1wRybLnsLA7170jIQ8r/Bj+0Gno9kkTGi9tsTrh6B7t31vvXfir8Lpysg/UVWU5Qv8i4Nt7s9I64U9LZBNF/1bKVEnKZpNznR9eka0T/rwU9xljTLuvjZmT/N4M+Tw26ogJPyRVbpD1L8py46P+7YlsXch7670LfxX+4EjnaLf+R4RXXdyldcIPSVYf4pzr8Gjr9kDuR29CWif8gFS2rrT7PSadqiGn6qJZYuEn4O63Frt2ax7ZzHObUTnJh8I2g+5umuoUfl4fNs8yVVavLtDlBhmgcxPCD+LV2X+HNX/Oaf9byGbO8mtlGMGmfo4f33rvwl+Ll291Ml3u9WfqhqpLAbC0MNzkYYWfgA+lVBzHc1JZeOqhfDAxVYmn/uTVhX8Y/nAyMc7j1DMnUTQpbYmCKa4Tfh4eZ1/zecQ8bjdDjKU0iuuEH5Eftq7MDVcTxOkzieWT2MphhR+Tug9bHfFv6t7sGKNN0TnTpJPwQxL1OmAvC5ejiOzzdWHhVnRGTPhB3PTf64QLFy5cuHDhwv8I/F/uK4F3xSCgRwAAAABJRU5ErkJggg==", 
 "value": "otpauth://totp/TOTP0008C54E?secret=ND2QFT6LIMFXCEARWIMTBT456NY6K7H5&amp;counter=1&amp;digits=6&amp;issuer=privacyIDEA"
 },</pre>
<p>In the same way you could let the user manage his tokens, delete them, reset PINs etc&#8230;</p>
<p>For more information see the <a href="http://privacyidea.readthedocs.io/en/latest/modules/api.html" target="_blank">complete REST API documentation</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.privacyidea.org/create-user-portal/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Crypto Considerations</title>
		<link>https://www.privacyidea.org/crypto-considerations/</link>
					<comments>https://www.privacyidea.org/crypto-considerations/#respond</comments>
		
		<dc:creator><![CDATA[Cornelius Kölbel]]></dc:creator>
		<pubDate>Fri, 15 Jan 2016 17:00:06 +0000</pubDate>
				<category><![CDATA[documentation]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Crypto]]></category>
		<guid isPermaLink="false">https://www.privacyidea.org/?p=846</guid>

					<description><![CDATA[Today I added the crypto considerations to the FAQ section of the privacyIDEA documentation. Users who might want to use privacyIDEA will wonder how crypto is handled. So this makes it easier for them to get a first impression without having to study the source code. In fact this is also a good review for the project [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a href="https://www.privacyidea.org/wp-content/uploads/2016/01/cryptography-1091254_640.jpg" rel="attachment wp-att-848"><img loading="lazy" decoding="async" class="size-medium wp-image-848 alignleft" src="https://www.privacyidea.org/wp-content/uploads/2016/01/cryptography-1091254_640-300x212.jpg" alt="cryptography-1091254_640" width="300" height="212" srcset="https://www.privacyidea.org/wp-content/uploads/2016/01/cryptography-1091254_640-300x212.jpg 300w, https://www.privacyidea.org/wp-content/uploads/2016/01/cryptography-1091254_640.jpg 640w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a>Today I added the <a href="http://privacyidea.readthedocs.org/en/latest/faq/crypto-considerations.html" target="_blank">crypto considerations to the FAQ section of the privacyIDEA documentation</a>.</p>
<p>Users who might want to use privacyIDEA will wonder how crypto is handled. So this makes it easier for them to get a first impression without having to study the source code.</p>
<p>In fact this is also a good review for the project itself, too. At several places we still use hard coded SHA256. With the hashing of the OTP Pins and the signing of the Audit data.</p>
<p>But having this crypto paper at hand, we know, which places we need to touch in only a few years!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.privacyidea.org/crypto-considerations/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Screencast about two factor with U2F</title>
		<link>https://www.privacyidea.org/screencast-about-two-factor-with-u2f/</link>
					<comments>https://www.privacyidea.org/screencast-about-two-factor-with-u2f/#respond</comments>
		
		<dc:creator><![CDATA[Cornelius Kölbel]]></dc:creator>
		<pubDate>Tue, 01 Dec 2015 10:25:04 +0000</pubDate>
				<category><![CDATA[documentation]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[SAML]]></category>
		<category><![CDATA[SSO]]></category>
		<category><![CDATA[U2F]]></category>
		<guid isPermaLink="false">https://www.privacyidea.org/?p=812</guid>

					<description><![CDATA[In the privacyIDEA youtube channel, you can see a new video about the new U2F Features in the latest release 2.8. Watch this video on YouTube. This way you can add two factor authentication with cheap and easy to use U2F devices to your network. You can implement the SAML IdP using simpleSAMLphp and the [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In the privacyIDEA youtube channel, you can see a new video about the <a href="https://www.privacyidea.org/privacyidea-with-saml-and-u2f/">new U2F Features in the latest release 2.8</a>.</p>
<p><a href="https://www.privacyidea.org/screencast-about-two-factor-with-u2f/"><img decoding="async" src="https://www.privacyidea.org/wp-content/plugins/wp-youtube-lyte/lyteCache.php?origThumbUrl=%2F%2Fi.ytimg.com%2Fvi%2F0VKFGSAlL80%2Fhqdefault.jpg" alt="YouTube Video"></a><br /> <a href="https://youtu.be/0VKFGSAlL80" target="_blank">Watch this video on YouTube</a>.</p>
<p>This way you can add two factor authentication with cheap and easy to use U2F devices to your network. You can implement the <a href="https://simplesamlphp.org/modules" target="_blank">SAML IdP using simpleSAMLphp and the privacyIDEA plugin</a>.</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.privacyidea.org/screencast-about-two-factor-with-u2f/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
