認証 Java は、Web アプリケーションの本人確認に対するセキュリティの用語です。プログラミング言語を使用してWebサイト・Webアプリケーションの本人確認を行う機能です。ユーザーの使用を確認し、Java テクノロジーを使用した Web サイト、アプリケーション、ソフトウェア関連製品へのアクセスを許可します。 Java言語のセキュリティ規約を利用して、許可されたユーザーを特定し、アプリケーションの使用を許可するセキュリティ方式です。
無料ソフトウェア開発コースを始めましょう
Web 開発、プログラミング言語、ソフトウェア テスト、その他
これは、独自のコンテンツを使用し、セキュリティ パスワードとユーザー ID で確認するためのクライアントおよびサーバー側の機能です。クライアント側でユーザー ID とパスワードを使用し、Java プログラミング言語を使用して真の識別情報を使用してサーバー側データにアクセスします。これは、Web アプリケーションを安全に保ち、アクセス可能なチーム メンバーのみを使用するための文書化プロセスです。
構文
この構文は、生徒、教師、非教職員、校長など、ユーザーの特定のブランチを認証するために使用されます。ユーザー名、電子メール ID、パスワードを使用してログインし、本人確認を行うことができます。
この構文では、アプリケーションは認証にユーザー名とパスワードを使用します。
public class AppSecurityConfig extends AppSecurityConfigurerAdapter { @Override protected void configure(AuthenticationManagerBuilder authentic) throws Exception { UserBuilder userid = User.withDefaultPasswordEncoder(); authentic.inMemoryAuthentication() .withUser(usersid.username("merry").password("test@123").roles("student")) } @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .antMatchers("/").hasRole("student") .and() .formLogin() .loginPage("/useLoginPage") .loginProcessingUrl("/authenticatationUser") .permitAll() .and() .logout().permitAll(); } }
Java では認証はどのように機能しますか?
セキュリティとログインフォームを備えた Web アプリケーションを使用します。このフォームは JSP ページにリダイレクトされます。
<form action="%24%7BpageContext.request.contextPath%7D/authenticateUser" method="POST"> <if test="${param.error ! = null}"> <b class="failed"> username/password does not authenticate here… </b> </if> <p> User ID: <input type="text" name="name"> </p> <p> Password: <input type="password" name="pswrd"> </p> <input type="submit" value="Submit"> </form>
ログインフォームの認証にはWebアプリケーションを使用します。このフォームは JSP ページにリダイレクトされます。
<p> User: <authentication property="principal.username"></authentication> </p>
Java Spring フレームワークを使用して Java 認証構文を使用します。 Java は Spring セキュリティを使用して権限を認証します。
public class AppSecurityConfig extends AppSecurityConfigurerAdapter { @Override protected void configure(AuthenticationManagerBuilder authentic) throws Exception { UserBuilder userid = User.withDefaultPasswordEncoder(); authentic.inMemoryAuthentication() .withUser (usersid.username ("merry") .password ("test@123") .roles ("student")) } @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .antMatchers("/") .hasRole("student") .and() .formLogin() .loginPage("/useLoginPage") .loginProcessingUrl("/authenticatationUser") .permitAll() .and() .logout().permitAll(); } }
認証 Java の例
以下に例を示します:
例 #1
基本的な例を以下に示します。
コード:
ファイル:authenticationApp.java
public class authenticationApp extends AppSecurityConfigurerAdapter { @Override protected void configure(AuthenticationManagerBuilder authentic) throws Exception { UserBuilder userid = User.withDefaultPasswordEncoder(); authentic.inMemoryAuthentication() .withUser (usersid.username ("sunny") .password ("school@123") .roles ("student")) } @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .antMatchers("/") .hasRole("student") .and() .formLogin() .loginPage("/useLoginPage") .loginProcessingUrl("/authenticatationUser") .permitAll() .and() .logout().permitAll(); } }
ファイル: main_login.jsp
<form action="%24%7BpageContext.request.contextPath%7D/authenticateUser" method="POST"> <if test="${param.error ! = null}"> <b class="failed"> username/password does not authenticate here… </b> </if> <p> User ID: <input type="text" name="name"> </p> <p> Password: <input type="password" name="pswrd"> </p> <input type="submit" value="Submit"> </form> File: authentication.jspUser name:
出力:
出力
説明:
- ここでは、単一のユーザー名での単一ユーザー認証が表示されます。
- 「Sunny」は Java 認証を使用して学生ポータルにのみアクセスします。
- 単一の正規ユーザーに対して単一のフォームを取得します。
例 #2
Java の例と出力における 2 つの認証を以下に示します。
コード:
ファイル:authenticationApp.java
public class authenticationApp extends AppSecurityConfigurerAdapter { @Override protected void configure(AuthenticationManagerBuilder authentic) throws Exception { UserBuilder userid = User.withDefaultPasswordEncoder(); authentic.inMemoryAuthentication() .withUser (usersid.username ("merry") .password ("test@123") .roles ("student")) .withUser(users.username("sam") .password("exam@123") .roles("student", "teacher")) } @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .antMatchers("/").hasRole("student") .antMatchers("/teachers/**").hasRole("teacher") .and() .formLogin() .loginPage("/useLoginPage") .loginProcessingUrl("/authenticatationUser") .permitAll() .and() .logout().permitAll(); } }
ファイル: main_login.jsp
<form action="%24%7BpageContext.request.contextPath%7D/authenticateUser" method="POST"> <if test="${param.error ! = null}"> <b class="failed"> username/password does not authenticate here… </b> </if> <p> User ID: <input type="text" name="name"> </p> <p> Password: <input type="password" name="pswrd"> </p> <input type="submit" value="Submit"> </form> File: authentication.jspUser:
Teachrs portal
出力:
出力:
説明:
- ここでは、1 つのユーザー名に 2 つの認証が表示されています。
- 「サム」は Java 認証を使用して教師と生徒のポータルにアクセスします。
- 複数の認証ユーザーに対して 1 つのフォームを取得できます。
例 #3
Java の例と出力における複数の認証を以下に示します。
コード:
ファイル:authenticationApp.java
public class authenticationApp extends AppSecurityConfigurerAdapter { @Override protected void configure(AuthenticationManagerBuilder authentic) throws Exception { UserBuilder userid = User.withDefaultPasswordEncoder(); authentic.inMemoryAuthentication() .withUser (usersid.username ("merry") .password ("test@123") .roles ("student")) .withUser(users.username("sam") .password("exam@123") .roles("student", "teacher")) .withUser(users.username("Ram") .password("admin@123") .roles("student", "teacher", "principle")) } @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .antMatchers("/") .hasRole("student") .antMatchers("/teachers/**").hasRole("teacher") .antMatchers("/principles/**").hasRole("principle") .and() .formLogin() .loginPage("/useLoginPage") .loginProcessingUrl("/authenticatationUser") .permitAll() .and() .logout().permitAll(); } }
ファイル: main_login.jsp
<form action="%24%7BpageContext.request.contextPath%7D/authenticateUser" method="POST"> <if test="${param.error ! = null}"> <b class="failed"> username/password does not authenticate here… </b> </if> <p> User ID: <input type="text" name="name"> </p> <p> Password: <input type="password" name="pswrd"> </p> <input type="submit" value="Submit"> </form> File: authentication.jsp
出力:
出力:
説明:
- ここでは、単一のユーザー名に複数の認証が表示されています。
- 「Ram」は、Java 認証を使用して教師、生徒、管理者のポータルにアクセスします。
- 複数の認証ユーザーに対して 1 つのフォームを取得できます。
結論
Java の認証は、データと権限のセキュリティ、安全性、プライバシーを提供します。認証は、各ユーザーおよび権限がデータベースの一部にアクセスするために使用します。簡単、魅力的、ユーザーフレンドリー、エレガントな Web サイトと Web アプリケーションになります。この関数は、ユーザーの ID ごとにドキュメントを並べ替え、必要なデータのみを返します。他人のプライバシーを侵害することなく、複雑な情報を簡単に入手するのに役立ちます。
以上が認証Javaの詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于结构化数据处理开源库SPL的相关问题,下面就一起来看一下java下理想的结构化数据处理类库,希望对大家有帮助。

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于PriorityQueue优先级队列的相关知识,Java集合框架中提供了PriorityQueue和PriorityBlockingQueue两种类型的优先级队列,PriorityQueue是线程不安全的,PriorityBlockingQueue是线程安全的,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于java锁的相关问题,包括了独占锁、悲观锁、乐观锁、共享锁等等内容,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于多线程的相关问题,包括了线程安装、线程加锁与线程不安全的原因、线程安全的标准类等等内容,希望对大家有帮助。

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于枚举的相关问题,包括了枚举的基本操作、集合类对枚举的支持等等内容,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于Java的相关知识,其中主要介绍了关于关键字中this和super的相关问题,以及他们的一些区别,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于平衡二叉树(AVL树)的相关知识,AVL树本质上是带了平衡功能的二叉查找树,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于Java的相关知识,其中主要整理了Stream流的概念和使用的相关问题,包括了Stream流的概念、Stream流的获取、Stream流的常用方法等等内容,下面一起来看一下,希望对大家有帮助。


ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

AI Hentai Generator
AIヘンタイを無料で生成します。

人気の記事

ホットツール

SublimeText3 Linux 新バージョン
SublimeText3 Linux 最新バージョン

PhpStorm Mac バージョン
最新(2018.2.1)のプロフェッショナル向けPHP統合開発ツール

AtomエディタMac版ダウンロード
最も人気のあるオープンソースエディター

SAP NetWeaver Server Adapter for Eclipse
Eclipse を SAP NetWeaver アプリケーション サーバーと統合します。

ゼンドスタジオ 13.0.1
強力な PHP 統合開発環境

ホットトピック



