Apache Web Login Authentication

Apache Web Login Authentication:

Adding password protection to a web site using Apache web server authentication.

  AuthLDAPURL ldap://ldap.your-domain.com:389/o=stooges?uid?subAuthLDAPBindDN "cn=StoogeAdmin,o=stooges"AuthLDAPBindPassword secret1AuthLDAPGroupAttribute memberUidAuthLDAPGroupAttributeIsDN offRequire ldap-group cn=users,ou=group,o=stoogesRequire ldap-attribute gidNumber=100Satisfy any
</Directory>
...
Note:
  • Allow users (LDAP attribute:?memberUid) in group?gidNumber: 100?of?objectClass: posixGroup?which match to the login?uid, authentication approval.?
    The directive?AuthLDAPGroupAttribute?identifies the attribute to match with the login?uid.
  • AuthLDAPGroupAttributeIsDN:
    • on (default): Use DN (Distinguished name)?cn=Moe Howard,ou=MemberGroupA,o=stooges
    • off: Use username?moe
  • Multiple?Require ldap-group ...?statements may be included to allow multiple groups.
  • Multiple?Require ldap-attribute ...?statements may be included to allow multiple groups.
  • The directive?Satisfy any?is required if testing multiple conditions. Only one positive in any of the conditions is required to authenticate. Thus you can combine the following authorization schemes as well:
    • Require ldap-user
    • Require ldap-dn
    • Require ldap-attribute
    • Require ldap-filter

Concurrent File and LDAP authentication:

Apache can use both File and LDAP authentication concurently. This is sometimes required to run cron jobs with a login where you do not want to use a system login or login managed by a directory server in another department.

<Directory /ABC>Order deny,allowDeny from AllAuthType BasicAuthBasicProvider file ldapAuthName "Directory services login"AuthBasicAuthoritative  offAuthUserFile /srv/htpasswdAuthGroupFile /dev/nullAuthzLDAPAuthoritative offAuthLDAPURL "ldap://ldap.megacorp.com:389/ou=person,o=megacorp.com,c=us?uid?sub"
#  This user created for local cron jobs. It is not a system user and allows
#  the cron job to perform its task.
#  This user is not in the LDAP directory but in the password file /srv/htpasswdRequire user cronuserjobxRequire ldap-user usera userb
</Directory>
Note:
  • AuthBasicProvider file ldap?- Check password "file" authentication then LDAP
  • AuthBasicAuthoritative off?- Allows fall back to another auth scheme, in this case LDAP
  • AuthzLDAPAuthoritative off?- Allows fall back to other auth scheme besides LDAP, in this case file

Debugging Apache Authentication:

Set?LogLevel debug?when debugging authentication. This will log all the LDAP connection events and the LDAP attributes requested.


Authenticating with Microsoft Active directory using Microsoft's "Unix services for Windows":

AuthLDAPURL ldap://ldap.your-domain.com:389/ou=Employees,ou=Accounts,dc=sos,dc=com?sAMAccountName?sub
Also note that encrypted connections will use the URL prefix "ldaps://" and the added directives:
  • LDAPTrustedCA?directory-path/filename
  • LDAPTrustedCAType?type?
    Where the "type" is one of:
    • DER_FILE: file in binary DER format
    • BASE64_FILE: file in Base64 format
    • CERT7_DB_PATH: Netscape certificate database file

Restart Apache after editing the configuration file:?service httpd restart?for configuration changes to take effect.?
See?/var/log/httpd/error_log?for configuration errors.


Links:
  • YoLinux Tutorial: Configuration of an LDAP server?- includes a quick start example using the Three Stooges.
  • YoLinux Tutorial: Apache web server configuration
Apache documentation:
  • Apache 2.0:
    • mod_ldap
    • mod_auth_ldap
  • Apache 2.2:
    • mod_ldap
    • mod_authnz_ldap
Other LDAP modules:
  • Apache LDAP module auth_ldap?- (Apache 1.3)
  • Apache LDAP module mod_ldap?- (Apache 1.3)
  • Apache LDAP module mod_ldap_userdir?(Apache 2.x)
  • Apache mod_auth_ldap?web server module for authentication with Netscape or OpenLDAP servers (HowTo)

Using NIS for Apache Authentication:

This method authenticates using Apache on Linux and an NIS server. The advantage of using NIS, is the comonality of computer system accounts and web site logins. This configuration requires that the system the Apache web server is running on, must be using NIS authentication for system logins.

This requires a NIS server. See the?YoLinux.com NIS configuration tutorial.

Requires the Linux RPM package?mod_perl?and the following Perl modules:

  • ExtUtils-AutoInstall
  • Net-NIS
  • Apache2-AuthenNIS or Apache-AuthenNIS
The version of Apache determines which Perl modules to use:
  • Apache 2.2 (RHEL5, CentOS5, FC6): Use the Perl module Apache2-AuthenNIS.
  • Apache 2.0 (RHEL4, CentOS4, FC3): Use the Perl module Apache-AuthenNIS.

Download / Install Perl modules:

  • Download "ExtUtils-AutoInstall" as an RPM from?Dag?RPMs:?perl-ExtUtils-AutoInstall-0.63-1.2.el4.rf.noarch.rpm?
    Install:?rpm -ivh perl-ExtUtils-AutoInstall-0.63-1.2.el4.rf.noarch.rpm
  • Net-NIS: (CPAN)
    • tar xzf Net-NIS-0.34.tar.gz
    • cd Net-NIS-0.34/
    • perl Makefile.PL
    • make
    • make install
  • Apache(2)-AuthenNIS:
    Apache 2.2Apache 2.0
    Apache2-AuthenNIS: (CPAN)
    • tar xzf Apache2-AuthenNIS-0.15.tar.gz
    • cd Apache2-AuthenNIS-0.15
    • perl Makefile.PL
    • make
    • make install
    Apache-AuthenNIS: (CPAN)
    • tar xzf Apache-AuthenNIS-0.13.tar.gz
    • cd Apache-AuthenNIS-0.13
    • perl Makefile.PL
    • make
    • make install

Or install from CPAN via the internet:

  • perl -MCPAN -e shell?
    (Answer no)
  • install ExtUtils::AutoInstall
  • install Net::NIS
  • install Apache2::AuthenNIS (or Apache::AuthenNIS)
  • quit

Test Perl module:

File:?testApache2AuthenNIS.pl
#!/usr/bin/perl
BEGIN{push @INC, "/usr/lib/perl5/site_perl/5.8.8/Apache2";}
eval "use Apache2::AuthenNIS"; $hasApacheAuth = $@ ? 0 : 1;
printf "Apache2::AuthenNIS". ($hasApacheAuth ?  "" : " not") . " installed";
printf "\n";
Test:?[root]# ./testApache2AuthenNIS.pl
  • Good:?Apache2::AuthenNIS installed
  • Not good:?Apache2::AuthenNIS not installed
OR
File:?testApacheAuthenNIS.pl
#!/usr/bin/perl
BEGIN{push @INC, "/usr/lib/perl5/site_perl/5.8.5/Apache";}
eval "use Apache::AuthenNIS"; $hasApacheAuth = $@ ? 0 : 1;
printf "Apache::AuthenNIS". ($hasApacheAuth ?  "" : " not") . " installed";
printf "\n";
Test:?[root]# ./testAuthenNIS.pl
  • Good:?Apache::AuthenNIS installed
  • Not good:?Apache::AuthenNIS not installed

Apache NIS authentication Examples:

  1. require valid-user: Allow all users if authentication (password) is correct.
  2. require user greg phil bob: Allow only greg phil bob to login.
  3. require group accounting: Allow only users in group "accounting" to authenticate.

1) Restric access to NIS authenticated users:

Apache Configuration File:?httpd.conf?(portion)
..
...<Directory /home/domain/public_html/membersonly>AuthType BasicAuthName "Add your login message here."PerlAuthenHandler Apache2::AuthenNIS      - or Apache::AuthenNISPerlSetVar AllowAlternateAuth norequire valid-user
</Directory>...
..

2) Restrict to listed users greg, phil and bob, but still authenticate to NIS:

Apache Configuration File:?httpd.conf?(portion)
..
...<Directory /home/domain/public_html/membersonly>AuthType BasicAuthName "Add your login message here."PerlAuthenHandler Apache2::AuthenNIS      - or Apache::AuthenNISPerlSetVar AllowAlternateAuth norequire user greg phil bob
</Directory>...
..

3) Restrict access to NIS members of a specific NIS group:

Apache Configuration File:?httpd.conf?(portion)
..
...<Directory /home/domain/public_html/membersonly>AuthType BasicAuthName "Add your login message here."PerlAuthenHandler Apache2::AuthenNIS      - or Apache::AuthenNISPerlAuthzHandler Apache2::AuthzNIS        - or Apache::AuthzNISPerlSetVar AllowAlternateAuth norequire group accounting
</Directory>...
..
Note Apache2::AuthzNIS only checks for group membership by group name (not GID). Apache2::AuthenNIS still required to authenticate the user (check password).

Example showing password protection for user web directories:

Apache Configuration File:?httpd.conf?(portion)
..
...<IfModule mod_userdir.c>UserDir public_html
</IfModule><Directory /home/*/public_html>AuthType BasicAuthName "Add your login message here."PerlAuthenHandler Apache2::AuthenNIS      - or Apache::AuthenNISPerlSetVar AllowAlternateAuth norequire user valid-userAllowOverride FileInfo AuthConfig LimitOptions MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec<Limit GET POST OPTIONS>Order allow,denyAllow from all</Limit><LimitExcept GET POST OPTIONS>Order deny,allowDeny from all</LimitExcept>
</Directory>...
..

Also see?YoLinux SysAdmin: Perl Admin

Links:

  • NIS+ (More secure than NIS):
    • Apache::AuthenNISPlus
  • Group NIS authentication:
    • Apache2::AuthzNIS
    • Apache::AuthzNIS
Note:
  • Apache allows further restriction by client IP network address or subnet.
  • Passwords can also be sent over an encrypted https connection by use of the Apache directive?SSLRequireSSL. See?Apache SSL/TLS encryption

[Potential Pitfall]:?This method of authentication will fail if using "adjunct password maps". This Perl module requires the use of the library call?yp_match()?which must have access to the encrypted passwords. If "adjunct password maps" are used, then this is not accessible to processes other than root thus the web server daemon process?apache?will not be able to access the data required. Test your system using the command?ypcat passwd | head. If the second field is prefixed with "##", then this perl module will not work. If the second field is an encrypted password, then this perl module can work.


CGI to allow users to modify their NIS Passwords:

For those users who get a shell of?/sbin/nologin, the "cgipaf" web interface is ideal for user management of NIS passwords. Cgipaf uses PHP, cgi (written in C) and your system PAM authentication (or?/etc/passwd, /etc/shadow?files). Cgipaf also can manage mail accounts using procmail.

Download from?http://www.wagemakers.be/english/programs/cgipaf

Installation/configuration:

  • tar xf cgipaf-1.3.1.tar.gz
  • cd cgipaf-1.3.1/
  • ./configure --bindir=/var/www/cgi-bin --datadir=/srv/cgipaf --sysconfigdir=/etc/cgipaf --prefix=/opt?
    Note: nothing ends up in?/opt
  • make
  • make install
  • cd /srv/cgipaf
  • ln -s cgipasswd.php index.php

File:?/etc/httpd/conf.d/cgipaf.conf?(Red Hat style systems)

Alias /NIS/ "/srv/cgipaf/"<Directory "/srv/cgipaf">SSLRequireSSLOptions Indexes FollowSymLinksAllowOverride NoneOrder allow, denyAllow from all
</Directory> 
Note the Apache 2 directive "SSLRequireSSL" will only allow https encrypted access. This is important when managing passwords over the web.

The PHP pages reside in?/srv/cgipaf/. The compiled C cgi will reside in?/var/www/cgi-bin. The configuration file will be/etc/cgipaf/cgipaf.conf.

See the web page at?http://localhost/NIS/


Using a MySQL database for Apache Authentication:

Two Apache modules are available for database authentication:

  • MySQL: mod_auth_mysql (This tutorial)
    • Red Hat RPM package:?mod_auth_mysql
    • SuSE RPM package:?apache2-mod_auth_mysql
  • DBM database file: mod_auth_dbm?
    (Fast even for 1000's of users.)
Apache Configuration:
  • Red Hat:?/etc/httpd/conf/httpd.conf?or?/etc/httpd/conf.d/application.conf
  • SuSE:?/etc/apache2/httpd.conf?or?/etc/apache2/conf.d/application.conf
    ..
...

<Directory /home/domain/public_html/membersonly>
AuthType Basic
AuthName "Add your login message here."
AuthMySQLHost localhostAuthMySQLUser db_userAuthMySQLPassword db_passwordAuthMySQLDB database_name_used_for_authenticationAuthMysqlUserTable http_authAuthMySQLPwEncryption noneAuthMySQLEnable onrequire valid-user</Directory>.....
Examples:
  • require valid-user: Allow all users if authentication (password) is correct.
  • require user greg phil bob: Allow only greg phil bob to login.
  • require group accounting: Allow only users in group "accounting" to authenticate.

Directives:

DirectiveDescription
AuthMySQLEnable?OnIf 'Off', MySQL authentication will pass on the authentication job to the other authentication modules i.e password files.
AuthMySQLHosthost_nameName of MySQL Database hosr. i.e. 'localhost'
AuthMySQLPortTCP_Port_numberPort number of MySQL Database. Default: 3306
AuthMySQLDBdatabase_nameName of MySQL Database.
AuthMySQLUser?user_idMySQL Database login id.
AuthMySQLPassworduser_passwordMySQL Database login password. Plain text.
AuthMySQLUserTableuser_table_nameName of MySQL Databse table in the database which holds the user name and passwords.
AuthMySQLGroupTablegroup_table_nameDatabse table holding group info.
AuthMySQLNameFielduser_field_nameIf not using default field name 'user_name', then specify. Not case sensitive id CHAR or VARCHAR.
AuthMySQLPasswordFieldpassword_field_nameIf not using default field name 'user_passwd', then specify. Passwords are case sensitive.
AuthMySQLGroupFieldgroup_field_nameIf not using default field name 'groups', then specify.
AuthMySQLNoPasswd?OffOff: Passwords can be null ('').
On: password must be specified.
AuthMySQLPwEncryptionnoneOptions: none, crypt, scrambled (MySQL password encryption), md5, aes, sha. If you are going to use plain-text passwords for mysql authentication, you must include this directive with the argument "none".
AuthMySQLSaltFieldsalt_string mysql_column_nameSalt field to be used for crypt and aes.
AuthMySQLAuthoritativeonAuthenticate using other authentication modules after the user is successfully authenticated by the MySQL auth module. Default on: request is not passed on.
AuthMySQLKeepAlive?OffOff: Close the MySQL link after each authentication request.

MySQL Admin:

  • mysqladmin -h localhost -u root -ppassword?create http_auth
  • mysql -h localhost -u root -ppassword
  • mysql>?use http_auth
  • mysql>?create table mysql_auth ( user_name char(30) NOT NULL,user_passwd char(60) NOT NULL,user_group char(25),primary key (user_name) );
  • mysql>?insert into mysql_auth values('Fred','supersecret','worker');

Links:

  • Home page for mod_auth_mysql
  • Home page for mod_auth_dbm [Apache 1.3] - [Apache 2.0]
  • YoLinux MySQL tutorial

Login URL Tricks:

Here is a trick to incorporate a login and password into a URL. Typicall one would attempt to enter the password protected area of the web site and the user would be confronted with a login dialog box into which one would enter the user id and password. Another option is to enter a URL with the login and password embedded.

    http://login-id:password@UrlOfDomain.com/protectedPath/WebPage.html

Links:
Apache:
  • NCSA User Authentication Tutorial?- http://hoohoo.ncsa.uiuc.edu/docs/tutorials/user.html
  • Users authentication with .dbmpasswd password file
  • Apache::AuthenSmb,?Apache2::AuthenSmb?- Microsoft Active Directory authentication
  • Apache::AuthenMSAD,?Apache2::AuthenMSAD?- Samba NT PDC authentication
  • Apache::AuthenNTLM,?Apache2::AuthenNTLM?- Microsoft NTLM LAN protocol suported by MS/Internet Explorer. Login/password credentials passed on the web server by IE browser.
Other forms of web authentication:
  • Facebook Platform authentication?- Using OAuth protocol, the Facebook API allows developers to use Javascript, PHP, Python, etc.?
    IETF OAuth 2.0 Protocol draft
  • OpenID?- decentralized URL based auth?
    Authentication Server Providers:
    • Yahoo OpenID
    • Google OpenID?
      OpenID for Google Apps API
    • Launchpad
    • Verisign OpenID?- two factor auth
    API:
    • mod_auth_openid?- Apache 2
    • OpenId4Java
    • List of OpenID Libraries?- developer interfaces
  • SAML: Security Assertion Markup Language?- XML based authentication?
    Authentication Server Providers:
    • Google SAML

轉:http://www.yolinux.com/TUTORIALS/LinuxTutorialApacheAddingLoginSiteProtection.html

轉載于:https://www.cnblogs.com/shuaixf/archive/2011/04/29/2032876.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/378471.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/378471.shtml
英文地址,請注明出處:http://en.pswp.cn/news/378471.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

oracle中的with的用法,oracle中with子句的用法(轉)

語法&#xff1a;WITH query_name AS (subquery)[, query_name AS (subquery) ]...使用在主select關鍵字前&#xff0c;oracle將其當做一個內聯視圖或者臨時表使用。例子&#xff1a;1.最簡單的使用方法&#xff1a;如查詢部門名稱包含“A”的所有員工信息--with clausewith a …

模擬一個排隊系統

現在有一個數據源&#xff0c;有兩種狀態&#xff08;ON OFF&#xff09;&#xff0c;ON的持續時間服從均值為T_on的指數分布&#xff0c;OFF的持續時間服從均值為T_off的指數分布&#xff0c;源只在ON的時候產生數據包&#xff0c;服從均值為λ的指數分布 模擬一個排隊系統 每…

stl中copy()函數_std :: copy_if()函數以及C ++ STL中的示例

stl中copy()函數C STL std :: copy_if()函數 (C STL std::copy_if() function) copy_if() function is a library function of algorithm header, it is used to copy the elements of a container, it copies the certain elements (which satisfy the given condition) of a…

C++語法:求vector中的最大值及其位置

代碼&#xff1a; #include <iostream> #include <vector> #include <algorithm> using namespace std;int main(){vector<int> a { 2,4,6,7,1,0,8,9,6,3,2 };auto maxPosition max_element(a.begin(), a.end());cout << *maxPosition <&l…

二、織物具備超級防水效果的條件?

織物具備超級防水效果的條件? 收集資料階段 蓮花效應(Lotus Effect),指蓮葉表面具有超疏水(superhydrophobicity)以及自潔(self-cleaning)的特性。 由于蓮葉具有疏水、不吸水的表面,落在葉面上的雨水會因表面張力的作用形成水珠,換言之,水與葉面的接觸角(contacta…

C#編碼簡單性之函數篇(如何編寫簡短的C#代碼,隨時更新)

作者&#xff1a;陳勇出處&#xff1a;blog.csdn.net/cheny_com這是編碼簡單性系列中的其中一篇&#xff0c;之前幾篇包括代碼篇和語義篇。因為要積累案例&#xff0c;會隨時更新。之前提到&#xff1a;編碼簡單性的“心法”就是&#xff1a;只要屏幕上有任何兩部分代碼看上去相…

R學習筆記(1):R是什么

本文最新版已更新至http://thinkinside.tk/2013/05/03/r_notes_1_what.html 在學習量化投資的時候&#xff0c;我發現了R&#xff08;www.r-project.org&#xff09;。R到底是什么呢&#xff1f;在開始之前&#xff0c;先看看R的神奇之處。 1. R初窺 從CRAN&#xff08;The Co…

oracle網卡,Oracle_bond網卡配置

***************************loyu*******************************************************雙網卡創建bond虛擬網卡實驗*************************cat > /etc/sysconfig/network-scripts/ifcfg-bond0 << EofDEVICEbond0BOOTPROTOstaticONBOOTyesIPADDR172.16.116.60N…

Python | 展示一個break語句示例

break is a keyword in python just like another programming language and it is used to break the execution of loop statement. 就像另一種編程語言一樣&#xff0c; break是python中的關鍵字&#xff0c;用于中斷loop語句的執行。 In the given example, loop is runni…

數字圖像處理知識總結

一&#xff1a;基本概念 數字圖像&#xff1a;指由被稱作像素的小塊區域組成的二維矩陣。將物理圖像行列劃分后&#xff0c;每個小塊區域稱為像素&#xff08;pixel&#xff09;。每個像素包括兩個屬性&#xff1a;位置和灰度。圖像數字化一般分為采樣、量化與編碼三個步驟。數…

三、“滌綸纖維和棉纖維兩組分纖維在滌/棉混紡織物燃燒過程中有著明顯的物理相互作用和化學相互作用”,解釋這兩種作用。

“滌綸纖維和棉纖維兩組分纖維在滌/棉混紡織物燃燒過程中有著明顯的物理相互作用和化學相互作用”,解釋這兩種作用。 收集資料階段 棉纖維燃燒后炭化,而滌綸燃燒時熔融滴落,由于棉纖維成為支持體,可使熔融纖維聚集,并阻止其滴落,使熔融纖維燃燒更加劇烈,即所謂"支架效應…

關于性能測試的通俗解釋

關于性能測試的通俗解釋: http://www.docin.com/p-645879730.html 轉載于:https://www.cnblogs.com/preftest/archive/2013/05/03/3057231.html

oracle marley,滾石雜志500大專輯,對歐美音樂感興趣的可以找來聽聽。

滾石雜志于2003年11月評選出的滾石雜志五百大專輯。值得一提的是&#xff0c;披頭士樂隊占據了前五中的三席&#xff0c;前五十中的7席&#xff0c;正式出版的專輯幾乎全部入選前五百。排名 演唱者 專輯001 披頭士樂隊(The Beatles) Sgt. Peppers Lonely Hearts Club Band002 海…

ci中使用smarty

<p>d</p> <?php defined(BASEPATH) or die(Access restricted!);/** 作者&#xff1a;晉勇*/require(APPPATH.libraries/smarty/Smarty.class.php);classCismarty extendsSmarty{public$exttpl;public$dir;public$layoutlayout/main;/** * 構造函數 * * access…

kinect中psi是什么_PSI的完整形式是什么?

kinect中psi是什么PSI&#xff1a;每平方英寸磅/國際人口服務 (PSI: Pound per Square Inch / Population Services International) 1)PSI&#xff1a;每平方英寸磅 (1) PSI: Pound per Square Inch) PSI is an abbreviation of Pound per Square Inch. Pound per Square Inch …

jupyter notebook指定工作目錄

【1】打開Anaconda Navigator 打開Anaconda Navigator&#xff0c;點擊左側Environments&#xff0c;點擊base(root)->open Terminal 【2】輸入指令jupyter notebook --generate-config 按下回車鍵&#xff0c;彈出config所在位置。 以VS Code打開文件 【3】修改第26…

四、纖維素纖維使用P-N系阻燃劑協同作用的原理?

纖維素纖維使用P-N系阻燃劑協同作用的原理? 收集資料階段 某些含氮、磷化合物可以增強化合物的阻燃性,原因就是磷、氮在反應過程中形成含 N-P 鍵的中間體,可以改善羰基反應活性和磷酰化速率,進而提高成炭率;另一個重要的原因是氮化合物可以延緩凝聚相中含磷化合物的會揮發…

oracle tns 連接關閉,ORA-12537 TNS:連接關閉

今天遇到&#xff1a;ORA-12537 TNS&#xff1a;連接關閉&#xff0c;監聽正常&#xff0c;集群正常&#xff0c;數據庫正常&#xff0c;查了一下才發現問題。LISTENER日志報錯TNS-12546: TNS:permission deniedTNS-12560: TNS:protocol adapter errorTNS-00516: Permission de…

多模態大模型:關于RLHF那些事兒

Overview 多模態大模型關于RLHF的代表性文章一、LLaVA-RLHF二、RLHF-V三、SILKIE多模態大模型關于RLHF的代表性文章 一、LLaVA-RLHF 題目: ALIGNING LARGE MULTIMODAL MODELS WITH FACTUALLY AUGMENTED RLHF 機構:UC伯克利 論文: https://arxiv.org/pdf/2309.14525.pdf 代碼…

c# 整數類型轉byte_C#中數據類型的整數類型

c# 整數類型轉byteHere is the list of the built-in integral types of data types in C#, sbyte, byte, char, short, ushort, int, uint, long and ulong 這是C&#xff03;&#xff0c; sbyte &#xff0c; byte &#xff0c; char &#xff0c; short &#xff0c; ushort…