| <!doctype html> |
| <html> |
| <head> |
| <meta charset="utf-8"> |
| <!-- Always force latest IE rendering engine or request Chrome Frame --> |
| <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible"> |
| |
| |
| <link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,300italic,400italic,400,600' rel='stylesheet' type='text/css'> |
| <!-- Use title if it's in the page YAML frontmatter --> |
| <title> |
| Authentication | |
| Geode Native .NET Docs |
| </title> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| <link href="/stylesheets/all.css" rel="stylesheet" media="screen, print" /> |
| <link href="/stylesheets/print.css" rel="stylesheet" media="print" /> |
| <link href='/images/favicon.ico' rel='shortcut icon'> |
| |
| <script src="/javascripts/all.js"></script> |
| |
| </head> |
| |
| <body class="docs docs_geode-native docs_geode-native_dotnet docs_geode-native_dotnet_113 docs_geode-native_dotnet_113_security docs_geode-native_dotnet_113_security_authentication has-subnav"> |
| |
| <div class="viewport"> |
| <div class='wrap'> |
| <script type="text/javascript"> |
| document.domain = "apache.org"; |
| </script> |
| |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| <header class="header header-layout"> |
| <h1 class="logo"> |
| <a href="/"> |
| <img src="/images/Apache_Geode_logo_symbol_white.png" style="width:30px;"> |
| Apache Geode Native .NET Documentation |
| </a> |
| </h1> |
| <div class="header-links js-bar-links"> |
| <div class="btn-menu" data-behavior="MenuMobile"></div> |
| <div class="header-item"><a href="http://geode.apache.org">Back to Product Page</a></div> |
| <div class="header-item"> |
| <a href="http://geode.apache.org/community" target="_blank">Community</a> |
| </div> |
| </div> |
| </header> |
| |
| |
| <div class="container"> |
| |
| <!--googleoff: index--> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| <div id="sub-nav" class="js-sidenav nav-container" role="navigation"> |
| <a class="sidenav-title" data-behavior="SubMenuMobile">Doc Index</a> |
| <div class="nav-content"> |
| <ul> |
| <li> |
| <a href="/docs/geode-native/dotnet/113/about-client-users-guide.html">Apache Geode Native Documentation</a> |
| </li> |
| <li class="has_submenu"> |
| <a href="/docs/geode-native/dotnet/113/getting-started/getting-started-nc-client.html">Getting Started with the Native Library</a> |
| <ul> |
| <li> |
| <a href="/docs/geode-native/dotnet/113/getting-started/getting-started-nc-client.html#set_up_dev_environment">Set Up Your Development Environment</a> |
| </li> |
| <li> |
| <a href="/docs/geode-native/dotnet/113/getting-started/getting-started-nc-client.html#establish_cluster_access">Establish Access to a Geode Cluster</a> |
| </li> |
| <li> |
| <a href="/docs/geode-native/dotnet/113/getting-started/getting-started-nc-client.html#app_dev_walkthroughs">Application Development Walkthroughs</a> |
| </li> |
| <li> |
| <a href="/docs/geode-native/dotnet/113/getting-started/getting-started-nc-client.html#programming_examples">Programming Examples</a> |
| </li> |
| <li> |
| <a href="/docs/geode-native/dotnet/113/getting-started/put-get-example.html">Put/Get/Remove Examples</a> |
| </li> |
| </ul> |
| </li> |
| <li class="has_submenu"> |
| <a href="/docs/geode-native/dotnet/113/configuring/configuration.html">Configuring a Client Application</a> |
| <ul> |
| <li> |
| <a href="/docs/geode-native/dotnet/113/configuring/system-level-configuration.html">System Level Configuration</a> |
| </li> |
| </ul> |
| </li> |
| |
| <li> |
| <a href="/docs/geode-native/dotnet/113/configuring/config-client-cache.html">Configuring the Client Cache</a> |
| </li> |
| <li class="has_submenu"> |
| <a href="/docs/geode-native/dotnet/113/regions/regions.html">Configuring Regions</a> |
| <ul> |
| <li> |
| <a href="/docs/geode-native/dotnet/113/regions/registering-interest-for-entries.html">Registering Interest for Entries</a> |
| </li> |
| <li> |
| <a href="/docs/geode-native/dotnet/113/regions/region-attributes.html">Region Attributes</a> |
| </li> |
| </ul> |
| </li> |
| |
| <li class="has_submenu"> |
| <a href="/docs/geode-native/dotnet/113/serialization/data-serialization.html">Serializing Data</a> |
| <ul> |
| <li class="has_submenu"> |
| <a href="/docs/geode-native/dotnet/113/serialization/dotnet-serialization/dotnet-pdx-serialization.html">Geode PDX Serialization</a> |
| <ul> |
| <li> |
| <a href="/docs/geode-native/dotnet/113/serialization/dotnet-serialization/dotnet-pdx-autoserializer.html">Using the Geode PDX Autoserializer</a> |
| </li> |
| <li> |
| <a href="/docs/geode-native/dotnet/113/serialization/dotnet-serialization/serialize-using-ipdxserializable.html">Using the IPdxSerializable Interface</a> |
| </li> |
| <li> |
| <a href="/docs/geode-native/dotnet/113/serialization/dotnet-serialization/pdx-serializable-examples.html">IPdxSerializable Examples</a> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| |
| <li> |
| <a href="/docs/geode-native/dotnet/113/remote-queries.html">Remote Queries</a> |
| </li> |
| |
| <li> |
| <a href="/docs/geode-native/dotnet/113/continuous-queries.html">Continuous Queries</a> |
| </li> |
| |
| <li class="has_submenu"> |
| <a href="/docs/geode-native/dotnet/113/security/security.html">Security: Authentication and Encryption</a> |
| <ul> |
| <li> |
| <a href="/docs/geode-native/dotnet/113/security/authentication.html">Authentication</a> |
| </li> |
| <li> |
| <a href="/docs/geode-native/dotnet/113/security/sslclientserver.html">TLS/SSL Client-Server Communication Encryption</a> |
| </li> |
| </ul> |
| </li> |
| |
| <li> |
| <a href="/docs/geode-native/dotnet/113/function-execution.html">Function Execution</a> |
| </li> |
| |
| <li> |
| <a href="/docs/geode-native/dotnet/113/transactions.html">Transactions</a> |
| </li> |
| <li> |
| <a href="/docs/geode-native/dotnet/113/configuring/sysprops.html">System Properties</a> |
| </li> |
| <li> |
| <a href="/docs/geode-native/dotnet/113/client-cache-ref.html">Client Cache XML Reference</a> |
| </li> |
| </ul> |
| </div> |
| </div> |
| |
| <!--googleon: index--> |
| |
| <main class="content content-layout" id="js-content" role="main"> |
| <a id="top"></a> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| <span style="font-weight:200;font-size:31px;" style="float:left;"> |
| <img src="/images/Apache_Geode_logo_symbol.png" style="height:26px;"> |
| Apache Geode Native .NET |
| </span> |
| <span class="local-header version-info" style="float:right;"> |
| <a href="https://cwiki.apache.org/confluence/display/GEODE/Release+Notes">CHANGELOG</a> |
| </span> |
| |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| <h1 class="title-container" > |
| Authentication |
| </h1> |
| |
| <div id="js-quick-links" > |
| |
| </div> |
| <div class="to-top" id="js-to-top"> |
| <a href="#top" title="back to top"></a> |
| </div> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| |
| <p>A client is authenticated when it connects with valid credentials to a Geode cache server that is configured with the client authentication callback. |
| For details on the server’s role in authentication and what it expects from the client, see <a href="geodeman/managing/security/implementing_authentication.html">Implementing Authentication</a> in the <em>Geode User Guide</em>.</p> |
| |
| <p>In your application, authentication credentials must be set when creating the cache. In practice, |
| this means setting the authentication credentials when you create the CacheFactory.</p> |
| |
| <h3 id=".net-authentication-example">.NET Authentication Example</h3> |
| |
| <p>The following excerpt is taken from the .NET example provided with your Native Client distribution in the <code>../examples/dotnet/authinitialize</code> directory.</p> |
| |
| <p>In this C# authentication example, the <code>CacheFactory</code> creation process sets the authentication callback:</p> |
| <pre class="highlight csharp"><code> <span class="kt">var</span> <span class="n">cacheFactory</span> <span class="p">=</span> <span class="k">new</span> <span class="nf">CacheFactory</span><span class="p">()</span> |
| <span class="p">.</span><span class="nf">Set</span><span class="p">(</span><span class="s">"log-level"</span><span class="p">,</span> <span class="s">"none"</span><span class="p">)</span> |
| <span class="p">.</span><span class="nf">SetAuthInitialize</span><span class="p">(</span><span class="k">new</span> <span class="nf">ExampleAuthInitialize</span><span class="p">());</span> |
| </code></pre> |
| |
| <p>Credentials are implemented in the <code>GetCredentials</code> member function of the <code>ExampleAuthInitialize</code> class, which implements the <code>IAuthInitialize</code> interface:</p> |
| <pre class="highlight csharp"><code> <span class="k">class</span> <span class="nc">ExampleAuthInitialize</span> <span class="p">:</span> <span class="n">IAuthInitialize</span> |
| <span class="p">{</span> |
| <span class="k">public</span> <span class="nf">ExampleAuthInitialize</span><span class="p">()</span> |
| <span class="p">{</span> |
| <span class="c1">// TODO initialize your resources here |
| </span> <span class="n">Console</span><span class="p">.</span><span class="n">Out</span><span class="p">.</span><span class="nf">WriteLine</span><span class="p">(</span><span class="s">"ExampleAuthInitialize::ExampleAuthInitialize called"</span><span class="p">);</span> |
| <span class="p">}</span> |
| |
| <span class="k">public</span> <span class="k">void</span> <span class="nf">Close</span><span class="p">()</span> |
| <span class="p">{</span> |
| <span class="c1">// TODO close your resources here |
| </span> <span class="n">Console</span><span class="p">.</span><span class="n">Out</span><span class="p">.</span><span class="nf">WriteLine</span><span class="p">(</span><span class="s">"ExampleAuthInitialize::Close called"</span><span class="p">);</span> |
| <span class="p">}</span> |
| |
| <span class="k">public</span> <span class="n">Properties</span><span class="p"><</span><span class="kt">string</span><span class="p">,</span> <span class="kt">object</span><span class="p">></span> <span class="nf">GetCredentials</span><span class="p">(</span><span class="n">Properties</span><span class="p"><</span><span class="kt">string</span><span class="p">,</span> <span class="kt">string</span><span class="p">></span> <span class="n">props</span><span class="p">,</span> <span class="kt">string</span> <span class="n">server</span><span class="p">)</span> |
| <span class="p">{</span> |
| <span class="c1">// TODO get your username and password |
| </span> <span class="n">Console</span><span class="p">.</span><span class="n">Out</span><span class="p">.</span><span class="nf">WriteLine</span><span class="p">(</span><span class="s">"ExampleAuthInitialize::GetCredentials called"</span><span class="p">);</span> |
| |
| <span class="kt">var</span> <span class="n">credentials</span> <span class="p">=</span> <span class="k">new</span> <span class="n">Properties</span><span class="p"><</span><span class="kt">string</span><span class="p">,</span> <span class="kt">object</span><span class="p">>();</span> |
| <span class="n">credentials</span><span class="p">.</span><span class="nf">Insert</span><span class="p">(</span><span class="s">"security-username"</span><span class="p">,</span> <span class="s">"root"</span><span class="p">);</span> |
| <span class="n">credentials</span><span class="p">.</span><span class="nf">Insert</span><span class="p">(</span><span class="s">"security-password"</span><span class="p">,</span> <span class="s">"root"</span><span class="p">);</span> |
| <span class="k">return</span> <span class="n">credentials</span><span class="p">;</span> |
| <span class="p">}</span> |
| <span class="p">}</span> |
| |
| </code></pre> |
| |
| |
| |
| </main> |
| </div> |
| </div> |
| </div> |
| |
| <div id="scrim"></div> |
| |
| <div class="container"> |
| <footer class="site-footer-links"> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| <div class="copyright"> |
| <a href='/'>Apache Geode Documentation</a> |
| © 2020 <a href='http://www.apache.org/'>The Apache Software Foundation</a>. |
| </div> |
| <div class="support"> |
| Need help? <a href="http://geode.apache.org/community" target="_blank">Visit the Community</a> |
| </div> |
| |
| </footer> |
| </div><!--end of container--> |
| |
| </body> |
| </html> |