<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Session handling on sillysky.net</title>
    <link>https://sillysky.net/docs/nyssr/records/session-handling/</link>
    <description>Recent content in Session handling on sillysky.net</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Tue, 09 Dec 2025 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://sillysky.net/docs/nyssr/records/session-handling/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>CRecordSessionCreateRight</title>
      <link>https://sillysky.net/docs/nyssr/records/session-handling/crecordsessioncreateright/</link>
      <pubDate>Tue, 09 Dec 2025 00:00:00 +0000</pubDate>
      <guid>https://sillysky.net/docs/nyssr/records/session-handling/crecordsessioncreateright/</guid>
      <description>&lt;p&gt;With this request a new permission is stored in the database. This new right&#xA;can then be assigned to users or roles by the administrator.&lt;/p&gt;&#xA;&lt;p&gt;This message belongs to the &lt;a href=&#34;https://sillysky.net/docs/nyssr/plugins/supplied-plugins/plugin-jars/ny_session2plugin/the-api-of-the-session-manager/&#34;&gt;Session Manager API&lt;/a&gt;.&lt;br&gt;&#xA;The message is part of the kernel.&lt;/p&gt;&#xA;&lt;pre class=&#34;ss-javacode&#34;&gt;&lt;code class=&#34;language-json&#34;&gt;{&#xA;  &#34;id&#34;: &#34;4b2bf3f8-7406-4829-9c1c-6f4c14188356&#34;,&#xA;  &#34;name&#34;: &#34;SESSION_CREATE_RIGHT&#34;,&#xA;  &#34;description&#34;: &#34;Create a new right.&#34;,&#xA;  &#34;slots&#34;: [&#xA;    {&#xA;      &#34;key&#34;: &#34;right&#34;,&#xA;      &#34;name&#34;: &#34;RIGHT&#34;,&#xA;      &#34;direction&#34;: &#34;REQUEST&#34;,&#xA;      &#34;presenceConstraint&#34;: &#34;MANDATORY&#34;,&#xA;      &#34;type&#34;: &#34;STRING&#34;,&#xA;      &#34;description&#34;: &#34;The new right to add.&#34;&#xA;    },&#xA;    {&#xA;      &#34;key&#34;: &#34;description&#34;,&#xA;      &#34;name&#34;: &#34;DESCRIPTION&#34;,&#xA;      &#34;direction&#34;: &#34;REQUEST&#34;,&#xA;      &#34;presenceConstraint&#34;: &#34;MANDATORY&#34;,&#xA;      &#34;type&#34;: &#34;STRING&#34;,&#xA;      &#34;description&#34;: &#34;The description of the new right.&#34;&#xA;    },&#xA;    {&#xA;      &#34;key&#34;: &#34;protected&#34;,&#xA;      &#34;name&#34;: &#34;PROTECTED&#34;,&#xA;      &#34;direction&#34;: &#34;REQUEST&#34;,&#xA;      &#34;presenceConstraint&#34;: &#34;OPTIONAL&#34;,&#xA;      &#34;type&#34;: &#34;BOOLEAN&#34;,&#xA;      &#34;description&#34;: &#34;True if the new right is protected.&#34;&#xA;    }&#xA;  ]&#xA;}&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2 id=&#34;usage&#34;&gt;Usage&lt;/h2&gt;&#xA;&lt;h3 id=&#34;sending-the-request&#34;&gt;Sending the request&lt;/h3&gt;&#xA;&lt;p&gt;You need the microservice ID of the session manager:&lt;/p&gt;</description>
    </item>
    <item>
      <title>CRecordSessionExpired</title>
      <link>https://sillysky.net/docs/nyssr/records/session-handling/crecordsessionexpired/</link>
      <pubDate>Tue, 09 Dec 2025 00:00:00 +0000</pubDate>
      <guid>https://sillysky.net/docs/nyssr/records/session-handling/crecordsessionexpired/</guid>
      <description>&lt;p&gt;In nyssr.net, when a session token expires or the session is closed, a&#xA;broadcast is sent to all nodes.&lt;br&gt;&#xA;You can register an observer for this message to receive it directly.&lt;/p&gt;&#xA;&lt;p&gt;This message belongs to the &lt;a href=&#34;https://sillysky.net/docs/nyssr/plugins/supplied-plugins/plugin-jars/ny_session2plugin/the-api-of-the-session-manager/&#34;&gt;session manager API&lt;/a&gt;.&lt;br&gt;&#xA;It is part of the kernel.&lt;/p&gt;&#xA;&lt;pre class=&#34;ss-javacode&#34;&gt;&lt;code class=&#34;language-java&#34;&gt;{&#xA;  &#34;id&#34;: &#34;274f6cd9-f1fe-4973-9f0e-fd26db19d276&#34;,&#xA;  &#34;name&#34;: &#34;SESSION_EXPIRED&#34;,&#xA;  &#34;description&#34;: &#34;A session has been expired due to inactivity.&#34;,&#xA;  &#34;isNanoService&#34;: &#34;true&#34;,&#xA;  &#34;namespaces&#34;: &#34;SYSTEM&#34;,&#xA;  &#34;slots&#34;: [&#xA;  ]&#xA;}&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2 id=&#34;usage&#34;&gt;Usage&lt;/h2&gt;&#xA;&lt;h3 id=&#34;install-the-observer&#34;&gt;Install the observer&lt;/h3&gt;&#xA;&lt;p&gt;The observer for receiving the message is easiest to set up by handling the&#xA;&lt;a href=&#34;https://sillysky.net/docs/nyssr/records/targetregistry/crecordstarttarget/&#34;&gt;CRecordStartTarget&lt;/a&gt; message. This is the message that every target&#xA;receives first after registration. Here, we use the &lt;a href=&#34;https://sillysky.net/docs/nyssr/other-interfaces/irecordhelper/&#34;&gt;RecordHelper&lt;/a&gt;.&#xA;Alternatively, you can retrieve the SYSTEM namespace, then the nanoservice&#xA;registry, and finally call the addObserver() method.&lt;/p&gt;</description>
    </item>
    <item>
      <title>CRecordSessionGetLongToken</title>
      <link>https://sillysky.net/docs/nyssr/records/session-handling/crecordsessiongetlongtoken/</link>
      <pubDate>Tue, 09 Dec 2025 00:00:00 +0000</pubDate>
      <guid>https://sillysky.net/docs/nyssr/records/session-handling/crecordsessiongetlongtoken/</guid>
      <description>&lt;p&gt;nyssr.net supports two types of session tokens: a long token with data and a&#xA;short token without data. If you want to exchange a short token for a long&#xA;token, this message can be used to retrieve the long token from the&#xA;SessionManager.&lt;/p&gt;&#xA;&lt;p&gt;This message belongs to the &lt;a href=&#34;https://sillysky.net/docs/nyssr/plugins/supplied-plugins/plugin-jars/ny_session2plugin/the-api-of-the-session-manager/&#34;&gt;session manager API&lt;/a&gt;.&lt;br&gt;&#xA;It is part of the kernel.&lt;/p&gt;&#xA;&lt;pre class=&#34;ss-javacode&#34;&gt;&lt;code class=&#34;language-java&#34;&gt;{&#xA;  &#34;id&#34;: &#34;bb156b98-b587-4e47-8c3a-eba8f1f512b8&#34;,&#xA;  &#34;name&#34;: &#34;SESSION_GET_LONG_TOKEN&#34;,&#xA;  &#34;description&#34;: &#34;Get a long session token with a short session token.&#34;,&#xA;  &#34;slots&#34;: [&#xA;    {&#xA;      &#34;key&#34;: &#34;1&#34;,&#xA;      &#34;name&#34;: &#34;SHORT_TOKEN&#34;,&#xA;      &#34;direction&#34;: &#34;REQUEST&#34;,&#xA;      &#34;presenceConstraint&#34;: &#34;MANDATORY&#34;,&#xA;      &#34;type&#34;: &#34;BYTE_ARRAY&#34;,&#xA;      &#34;description&#34;: &#34;The short session token.&#34;&#xA;    },&#xA;    {&#xA;      &#34;key&#34;: &#34;10&#34;,&#xA;      &#34;name&#34;: &#34;LONG_TOKEN&#34;,&#xA;      &#34;direction&#34;: &#34;RESPONSE&#34;,&#xA;      &#34;presenceConstraint&#34;: &#34;OPTIONAL&#34;,&#xA;      &#34;type&#34;: &#34;BYTE_ARRAY&#34;,&#xA;      &#34;description&#34;: &#34;The long session token.&#34;&#xA;    }&#xA;  ]&#xA;}&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2 id=&#34;usage&#34;&gt;Usage&lt;/h2&gt;&#xA;&lt;h3 id=&#34;sending-the-request&#34;&gt;Sending the request&lt;/h3&gt;&#xA;&lt;p&gt;You need the microservice ID of the session manager:&lt;/p&gt;</description>
    </item>
    <item>
      <title>CRecordSessionLogin</title>
      <link>https://sillysky.net/docs/nyssr/records/session-handling/crecordsessionlogin/</link>
      <pubDate>Tue, 09 Dec 2025 00:00:00 +0000</pubDate>
      <guid>https://sillysky.net/docs/nyssr/records/session-handling/crecordsessionlogin/</guid>
      <description>&lt;p&gt;This record is used for the login of a user.&lt;/p&gt;&#xA;&lt;p&gt;This message belongs to the &lt;a href=&#34;https://sillysky.net/docs/nyssr/plugins/supplied-plugins/plugin-jars/ny_session2plugin/the-api-of-the-session-manager/&#34;&gt;Session Manager API&lt;/a&gt;.&lt;br&gt;&#xA;It is part of the kernel.&lt;/p&gt;&#xA;&lt;pre class=&#34;ss-javacode&#34;&gt;&lt;code class=&#34;language-json&#34;&gt;{&#xA;  &#34;id&#34;: &#34;a8c83b58-a567-4eb9-b3b4-ce568899a696&#34;,&#xA;  &#34;name&#34;: &#34;SESSION_LOGIN&#34;,&#xA;  &#34;description&#34;: &#34;LogIn.&#34;,&#xA;  &#34;slots&#34;: [&#xA;    {&#xA;      &#34;key&#34;: &#34;userId&#34;,&#xA;      &#34;name&#34;: &#34;USER_ID&#34;,&#xA;      &#34;direction&#34;: &#34;REQUEST&#34;,&#xA;      &#34;presenceConstraint&#34;: &#34;MANDATORY&#34;,&#xA;      &#34;type&#34;: &#34;STRING&#34;,&#xA;      &#34;description&#34;: &#34;The user id.&#34;&#xA;    },&#xA;    {&#xA;      &#34;key&#34;: &#34;pw&#34;,&#xA;      &#34;name&#34;: &#34;PASSWORD&#34;,&#xA;      &#34;direction&#34;: &#34;REQUEST&#34;,&#xA;      &#34;presenceConstraint&#34;: &#34;MANDATORY&#34;,&#xA;      &#34;type&#34;: &#34;STRING&#34;,&#xA;      &#34;description&#34;: &#34;The base64 encoded hash (SHA384) of the password.&#34;&#xA;    }&#xA;  ]&#xA;}&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2 id=&#34;usage&#34;&gt;Usage&lt;/h2&gt;&#xA;&lt;h3 id=&#34;sending-the-request&#34;&gt;Sending the request&lt;/h3&gt;&#xA;&lt;p&gt;You need the microservice ID of the session manager:&lt;/p&gt;</description>
    </item>
    <item>
      <title>CRecordSessionLogout</title>
      <link>https://sillysky.net/docs/nyssr/records/session-handling/crecordsessionlogout/</link>
      <pubDate>Tue, 09 Dec 2025 00:00:00 +0000</pubDate>
      <guid>https://sillysky.net/docs/nyssr/records/session-handling/crecordsessionlogout/</guid>
      <description>&lt;p&gt;Quit the session.&lt;/p&gt;&#xA;&lt;p&gt;This message belongs to the &lt;a href=&#34;https://sillysky.net/docs/nyssr/plugins/supplied-plugins/plugin-jars/ny_session2plugin/the-api-of-the-session-manager/&#34;&gt;session manager API&lt;/a&gt;.&lt;br&gt;&#xA;It is part of the kernel.&lt;/p&gt;&#xA;&lt;pre class=&#34;ss-javacode&#34;&gt;&lt;code class=&#34;language-json&#34;&gt;{&#xA;  &#34;id&#34;: &#34;7f736870-b41b-48ea-9220-6f104cae17d3&#34;,&#xA;  &#34;name&#34;: &#34;SESSION_LOGOUT&#34;,&#xA;  &#34;isNanoService: &#34;false&#34;,&#xA;  &#34;type&#34;: &#34;REQUEST&#34;,&#xA;  &#34;description&#34;: &#34;Close the session.&#34;,&#xA;  &#34;slots&#34;: [&#xA;  ]&#xA;}&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2 id=&#34;usage&#34;&gt;Usage&lt;/h2&gt;&#xA;&lt;h3 id=&#34;sending-the-request&#34;&gt;Sending the request&lt;/h3&gt;&#xA;&lt;p&gt;You need the microservice ID of the session manager:&lt;/p&gt;&#xA;&lt;pre class=&#34;ss-javacode&#34;&gt;&lt;code class=&#34;language-java&#34;&gt;public static final &lt;a href=&#34;https://sillysky.net/docs/nyssr/ids-and-addresses/id/&#34;&gt;IId&lt;/a&gt; SESSION_MICROSERVICE_ID = &lt;a href=&#34;https://sillysky.net/docs/nyssr/ids-and-addresses/cidfactory/&#34;&gt;CIdFactory&lt;/a&gt;.fromObject(&#34;ccf168c1-f18b-4229-85f9-24461a19ee6a&#34;);&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;To close the session, we need the token we received when we &lt;a href=&#34;https://sillysky.net/docs/nyssr/records/session-handling/crecordsessionlogin/&#34;&gt;logged&lt;/a&gt;&#xA;in.&lt;/p&gt;&#xA;&lt;pre class=&#34;ss-javacode&#34;&gt;&lt;code class=&#34;language-java&#34;&gt;private void closeSession(final byte[] aToken) throws &lt;a href=&#34;https://sillysky.net/docs/nyssr/other-interfaces/cexception/&#34;&gt;CException&lt;/a&gt;&#xA;{&#xA;    final &lt;a href=&#34;https://sillysky.net/docs/nyssr/messages/cenvelope/&#34;&gt;CEnvelope&lt;/a&gt; env = &lt;a href=&#34;https://sillysky.net/docs/nyssr/messages/cenvelope/&#34;&gt;CEnvelope&lt;/a&gt;.forMicroService(SESSION_MICROSERVICE_ID);&#xA;    env.setSessionToken(aToken);&#xA;&#xA;    final &lt;a href=&#34;https://sillysky.net/docs/nyssr/messages/crecord/&#34;&gt;CRecord&lt;/a&gt; record = &lt;a href=&#34;https://sillysky.net/docs/nyssr/records/session-handling/crecordsessionlogout/&#34;&gt;CRecordSessionLogout&lt;/a&gt;.create();&#xA;    sendRequest(env,&#xA;                record);&#xA;}&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h3 id=&#34;dealing-with-the-response&#34;&gt;Dealing with the response&lt;/h3&gt;&#xA;&lt;p&gt;To catch the response of the request, we need a &lt;a href=&#34;https://sillysky.net/docs/nyssr/namespaces/targets/ctarget/imessagehandler/&#34;&gt;message handler&lt;/a&gt;. We&#xA;add it in the constructor of the &lt;a href=&#34;https://sillysky.net/docs/nyssr/namespaces/targets/ctarget/imessagehandlerregistry/&#34;&gt;message handler registry&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>CRecordSessionManagementAvailable</title>
      <link>https://sillysky.net/docs/nyssr/records/session-handling/crecordsessionmanagementavailable/</link>
      <pubDate>Tue, 09 Dec 2025 00:00:00 +0000</pubDate>
      <guid>https://sillysky.net/docs/nyssr/records/session-handling/crecordsessionmanagementavailable/</guid>
      <description>&lt;p&gt;The message CRecordSessionManagementAvailable is an announcement and is sent&#xA;to all nodes via broadcast. To receive it, an&#xA;&lt;a href=&#34;https://sillysky.net/docs/nyssr/namespaces/nanoservices/inanoserviceregistry/#AddingObserver&#34;&gt;observer&lt;/a&gt; must be installed on the&#xA;&lt;a href=&#34;https://sillysky.net/docs/nyssr/namespaces/nanoservices/&#34;&gt;nanoservice&lt;/a&gt; of the same name in the &lt;code&gt;SYSTEM&lt;/code&gt; namespace.&lt;/p&gt;&#xA;&lt;p&gt;This message belongs to the &lt;a href=&#34;https://sillysky.net/docs/nyssr/plugins/supplied-plugins/plugin-jars/ny_session2plugin/the-api-of-the-session-manager/&#34;&gt;session manager API&lt;/a&gt;.&lt;br&gt;&#xA;It is part of the kernel.&lt;/p&gt;&#xA;&lt;pre class=&#34;ss-javacode&#34;&gt;&lt;code class=&#34;language-json&#34;&gt;{&#xA;  &#34;id&#34;: &#34;ed0319bd-b50c-49e1-ade7-d9d7bcb67242&#34;,&#xA;  &#34;name&#34;: &#34;SESSION_MANAGEMENT_AVAILABLE&#34;,&#xA;  &#34;description&#34;: &#34;Broadcast: The session management is now available.&#34;,&#xA;  &#34;isNanoService&#34;: &#34;true&#34;,&#xA;  &#34;namespaces&#34;: &#34;SYSTEM&#34;,&#xA;  &#34;slots&#34;: [&#xA;    {&#xA;      &#34;key&#34;: &#34;av&#34;,&#xA;      &#34;name&#34;: &#34;IS_AVAILABLE&#34;,&#xA;      &#34;direction&#34;: &#34;REQUEST&#34;,&#xA;      &#34;presenceConstraint&#34;: &#34;MANDATORY&#34;,&#xA;      &#34;type&#34;: &#34;BOOLEAN&#34;,&#xA;      &#34;description&#34;: &#34;True: The session management is available.&#34;&#xA;    },&#xA;    {&#xA;      &#34;key&#34;: &#34;addr&#34;,&#xA;      &#34;name&#34;: &#34;ADDRESS&#34;,&#xA;      &#34;direction&#34;: &#34;REQUEST&#34;,&#xA;      &#34;presenceConstraint&#34;: &#34;MANDATORY&#34;,&#xA;      &#34;type&#34;: &#34;TARGET_ADDRESS&#34;,&#xA;      &#34;description&#34;: &#34;The address of the session management.&#34;&#xA;    }&#xA;  ]&#xA;}&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2 id=&#34;usage&#34;&gt;Usage&lt;/h2&gt;&#xA;&lt;h3 id=&#34;install-the-observer&#34;&gt;Install the observer&lt;/h3&gt;&#xA;&lt;p&gt;The observer for receiving the message is easiest to set up by handling the&#xA;&lt;a href=&#34;https://sillysky.net/docs/nyssr/records/targetregistry/crecordstarttarget/&#34;&gt;CRecordStartTarget&lt;/a&gt; message. This is the message that every target&#xA;receives first after registration. Here, we use the &lt;a href=&#34;https://sillysky.net/docs/nyssr/other-interfaces/irecordhelper/&#34;&gt;RecordHelper&lt;/a&gt;.&#xA;Alternatively, you can retrieve the SYSTEM namespace, then the nanoservice&#xA;registry, and finally call the addObserver() method.&lt;/p&gt;</description>
    </item>
    <item>
      <title>CRecordSessionValidate</title>
      <link>https://sillysky.net/docs/nyssr/records/session-handling/crecordsessionvalidate/</link>
      <pubDate>Tue, 09 Dec 2025 00:00:00 +0000</pubDate>
      <guid>https://sillysky.net/docs/nyssr/records/session-handling/crecordsessionvalidate/</guid>
      <description>&lt;p&gt;This record is needed when a session token we received from a user request is&#xA;to be checked for validity. With the response we also receive the user ID and&#xA;a list with the rights of the user.&lt;/p&gt;&#xA;&lt;p&gt;This message belongs to the &lt;a href=&#34;https://sillysky.net/docs/nyssr/plugins/supplied-plugins/plugin-jars/ny_session2plugin/the-api-of-the-session-manager/&#34;&gt;session manager API&lt;/a&gt;. It is part of the&#xA;kernel.&lt;/p&gt;&#xA;&lt;pre class=&#34;ss-javacode&#34;&gt;&lt;code class=&#34;language-json&#34;&gt;{&#xA;  &#34;id&#34;: &#34;deb4b364-0890-4380-8c36-a142fcb29034&#34;,&#xA;  &#34;name&#34;: &#34;SESSION_VALIDATE&#34;,&#xA;  &#34;description&#34;: &#34;Validate a token.&#34;,&#xA;  &#34;slots&#34;: [&#xA;    {&#xA;      &#34;key&#34;: &#34;userId&#34;,&#xA;      &#34;name&#34;: &#34;USER_ID&#34;,&#xA;      &#34;direction&#34;: &#34;RESPONSE&#34;,&#xA;      &#34;presenceConstraint&#34;: &#34;OPTIONAL&#34;,&#xA;      &#34;type&#34;: &#34;STRING&#34;,&#xA;      &#34;description&#34;: &#34;The user ID (only on SUCCESS).&#34;&#xA;    },&#xA;    {&#xA;      &#34;key&#34;: &#34;rights&#34;,&#xA;      &#34;name&#34;: &#34;RIGHTS&#34;,&#xA;      &#34;direction&#34;: &#34;RESPONSE&#34;,&#xA;      &#34;presenceConstraint&#34;: &#34;OPTIONAL&#34;,&#xA;      &#34;type&#34;: &#34;STRING_ARRAY&#34;,&#xA;      &#34;description&#34;: &#34;The rights the user has (only on SUCCESS).&#34;&#xA;    }&#xA;  ]&#xA;}&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;h2 id=&#34;usage&#34;&gt;Usage&lt;/h2&gt;&#xA;&lt;h3 id=&#34;sending-the-request&#34;&gt;Sending the request&lt;/h3&gt;&#xA;&lt;p&gt;You need the microservice ID of the session manager:&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
