JavaTM Platform
Standard Ed. 6

java.net
클래스 Authenticator

java.lang.Object 
  상위를 확장 java.net.Authenticator


public abstract class Authenticator
extends Object

Authenticator 클래스는, 네트워크 접속에 필요한 인증을 취득하기 위한 객체를 나타냅니다. 일반적으로은, 사용자에게 정보의 입력을 요구하는 것으로, 인증을 실시합니다.  

어플리케이션은, 서브 클래스에서 getPasswordAuthentication() 를 오버라이드(override) 하는 것으로 이 클래스를 사용합니다. 이 메소드는, 일반적으로, 다양한 getXXX() 액세스용 메소드를 사용해, 인증을 요구하고 있는 엔티티에 관한 정보를 가져옵니다. 다음에, 사용자와의 대화, 또는 그 외의 대화 이외 방법으로, 사용자명과 패스워드를 취득할 필요가 있습니다. 그 후,PasswordAuthentication 의 반환값으로서 자격이 돌려주어집니다.  

다음에,setDefault(Authenticator) 를 호출하는 것으로, 이 구상 서브 클래스의 인스턴스가 시스템에 등록됩니다. 인증이 필요한 경우, 시스템은 requestPasswordAuthentication() 메소드의 1 개를 호출해, 이것이 등록된 객체의 getPasswordAuthentication() 메소드를 호출합니다.  

인증을 요구하는 메소드는 모두, 실패에 끝나는 디폴트 구현을 가지고 있습니다.

도입된 버젼:
1.2
관련 항목:
setDefault(java.net.Authenticator) , getPasswordAuthentication()

상자의 클래스의 개요
static class Authenticator.RequestorType
          인증을 요구하고 있는 엔티티의 타입.
 
생성자 의 개요
Authenticator ()
           
 
메소드의 개요
protected  PasswordAuthentication getPasswordAuthentication ()
          패스워드 인증이 필요한 경우에 불려 갑니다.
protected  String getRequestingHost ()
          인증을 요구하고 있는 사이트 또는 프록시의 hostname 를 가져옵니다.
protected  int getRequestingPort ()
          요구된 접속에 사용하는 포트 번호를 가져옵니다.
protected  String getRequestingPrompt ()
          요구자가 입력한 prompt 캐릭터 라인을 가져옵니다.
protected  String getRequestingProtocol ()
          접속을 요구하고 있는 프로토콜을 돌려줍니다.
protected  String getRequestingScheme ()
          요구자가 사용하고 있는 방식 (예를 들어, HTTP 방화벽(fire wall)의 경우는 HTTP 방식)
protected  InetAddress getRequestingSite ()
          허가를 요구하고 있는 사이트의 InetAddress 를 가져옵니다.
protected  URL getRequestingURL ()
          이 인증 요구의 결과인 URL 를 돌려줍니다.
protected  Authenticator.RequestorType getRequestorType ()
          요구자가 프록시인가 서버인지를 돌려줍니다.
static PasswordAuthentication requestPasswordAuthentication (InetAddress  addr, int port, String  protocol, String  prompt, String  scheme)
          시스템에 등록되어 있는 Authenticator에, 패스워드를 요구합니다.
static PasswordAuthentication requestPasswordAuthentication (String  host, InetAddress  addr, int port, String  protocol, String  prompt, String  scheme)
          시스템에 등록되어 있는 Authenticator에, 패스워드를 요구합니다.
static PasswordAuthentication requestPasswordAuthentication (String  host, InetAddress  addr, int port, String  protocol, String  prompt, String  scheme, URL  url, Authenticator.RequestorType  reqType)
          시스템에 등록되어 있는 Authenticator에, 패스워드를 요구합니다.
static void setDefault (Authenticator  a)
          Authenticator를 설정합니다.
 
클래스 java.lang. Object 로부터 상속된 메소드
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait
 

생성자 의 상세

Authenticator

public Authenticator()
메소드의 상세

setDefault

public static void setDefault(Authenticator  a)
Authenticator를 설정합니다. 이 Authenticator는, 프록시 서버-또는 HTTP 서버로부터 Authenticator가 요구되었을 때에, 네트워크 코드가 사용합니다.  

시큐리티 매니저가 존재하는 경우, 최초로 시큐리티 매니저의 checkPermission 메소드가, 액세스권 NetPermission("setDefaultAuthenticator") 를 지정해 불려 갑니다. 이 결과, java.lang.SecurityException 가 되는 일이 있습니다.

파라미터:
a - 설정되는 Authenticator. a 가 null 의 경우, 이전으로 설정된 Authenticator는 삭제된다
예외:
SecurityException - 시큐리티 매니저가 존재해, 그 checkPermission 메소드가 데포르트Authenticator의 설정을 허가하지 않는 경우
관련 항목:
SecurityManager.checkPermission(java.security.Permission) , NetPermission

requestPasswordAuthentication

public static PasswordAuthentication  requestPasswordAuthentication(InetAddress  addr,
                                                                   int port,
                                                                   String  protocol,
                                                                   String  prompt,
                                                                   String  scheme)
시스템에 등록되어 있는 Authenticator에, 패스워드를 요구합니다.  

시큐리티 매니저가 존재하는 경우, 최초로 시큐리티 매니저의 checkPermission 메소드가, 액세스권 NetPermission("requestPasswordAuthentication") 를 지정해 불려 갑니다. 이 결과, java.lang.SecurityException 가 되는 일이 있습니다.

파라미터:
addr - 인증을 요구하고 있는 사이트의 InetAddress. InetAddress 가 불명의 경우는 null
port - 요구된 접속에 사용하는 포트 번호
protocol - 접속을 요구하고 있는 프로토콜 (getRequestingProtocol() )
prompt - 사용자에게 표시되는 prompt 캐릭터 라인
scheme - 인증 방식
반환값:
사용자명 또는 패스워드. 취득할 수 없는 경우는 null
예외:
SecurityException - 시큐리티 매니저가 존재해, 그 checkPermission 메소드가 패스워드 인증 요구를 허가하지 않는 경우
관련 항목:
SecurityManager.checkPermission(java.security.Permission) , NetPermission

requestPasswordAuthentication

public static PasswordAuthentication  requestPasswordAuthentication(String  host,
                                                                   InetAddress  addr,
                                                                   int port,
                                                                   String  protocol,
                                                                   String  prompt,
                                                                   String  scheme)
시스템에 등록되어 있는 Authenticator에, 패스워드를 요구합니다. InetAddress 를 사용할 수 없는 경우는 호스트명이 제공되므로, 이 방법으로 패스워드를 요구하는 것을 추천합니다.  

시큐리티 매니저가 존재하는 경우, 최초로 시큐리티 매니저의 checkPermission 메소드가, 액세스권 NetPermission("requestPasswordAuthentication") 를 지정해 불려 갑니다. 이 결과, java.lang.SecurityException 가 되는 일이 있습니다.

파라미터:
host - 인증을 요구하고 있는 사이트의 호스트명
addr - 인증을 요구하고 있는 사이트의 InetAddress. InetAddress 가 불명의 경우는 null
port - 요구된 접속에 사용하는 포트 번호
protocol - 접속을 요구하고 있는 프로토콜 (getRequestingProtocol() )
prompt - 인증 영역을 식별하는, 사용자에게 표시되는 prompt 캐릭터 라인
scheme - 인증 방식
반환값:
사용자명 또는 패스워드. 취득할 수 없는 경우는 null
예외:
SecurityException - 시큐리티 매니저가 존재해, 그 checkPermission 메소드가 패스워드 인증 요구를 허가하지 않는 경우
도입된 버젼:
1.4
관련 항목:
SecurityManager.checkPermission(java.security.Permission) , NetPermission

requestPasswordAuthentication

public static PasswordAuthentication  requestPasswordAuthentication(String  host,
                                                                   InetAddress  addr,
                                                                   int port,
                                                                   String  protocol,
                                                                   String  prompt,
                                                                   String  scheme,
                                                                   URL  url,
                                                                   Authenticator.RequestorType  reqType)
시스템에 등록되어 있는 Authenticator에, 패스워드를 요구합니다.  

시큐리티 매니저가 존재하는 경우, 최초로 시큐리티 매니저의 checkPermission 메소드가, 액세스권 NetPermission("requestPasswordAuthentication") 를 지정해 불려 갑니다. 이 결과, java.lang.SecurityException 가 되는 일이 있습니다.

파라미터:
host - 인증을 요구하고 있는 사이트의 호스트명
addr - 인증을 요구하고 있는 사이트의 InetAddress. InetAddress 가 불명의 경우는 null
port - 요구된 접속에 사용하는 포트 번호
protocol - 접속을 요구하고 있는 프로토콜 (getRequestingProtocol() )
prompt - 사용자에게 표시되는 prompt 캐릭터 라인
scheme - 인증 방식
url - 인증을 발생시킨 요구원의 URL
reqType - 인증을 요구하고 있는 엔티티의 타입 (서버 또는 프록시)
반환값:
사용자명 또는 패스워드. 취득할 수 없는 경우는 null
예외:
SecurityException - 시큐리티 매니저가 존재해, 그 checkPermission 메소드가 패스워드 인증 요구를 허가하지 않는 경우
도입된 버젼:
1.5
관련 항목:
SecurityManager.checkPermission(java.security.Permission) , NetPermission

getRequestingHost

protected final String  getRequestingHost()
인증을 요구하고 있는 사이트 또는 프록시의 hostname 를 가져옵니다. hostname 를 사용할 수 없는 경우는 null 가 돌려주어집니다.

반환값:
인증을 요구하고 있는 접속의 호스트명. InetAddress 를 사용할 수 없는 경우는 null
도입된 버젼:
1.4

getRequestingSite

protected final InetAddress  getRequestingSite()
허가를 요구하고 있는 사이트의 InetAddress 를 가져옵니다. InetAddress 를 사용할 수 없는 경우는 null 가 돌려주어집니다.

반환값:
인증을 요구하고 있는 사이트의 InetAddress. InetAddress 를 사용할 수 없는 경우는 null

getRequestingPort

protected final int getRequestingPort()
요구된 접속에 사용하는 포트 번호를 가져옵니다.

반환값:
요구된 접속의 포트를 나타내는 int

getRequestingProtocol

protected final String  getRequestingProtocol()
접속을 요구하고 있는 프로토콜을 돌려줍니다. 많은 경우, 프로토콜은 URL 를 기본으로 하고 있습니다. 그러나 장래의 JDK 에서는, 예를 들어, 패스워드로 보호된 SOCKS5 방화벽(fire wall)에는 「SOCKS」라고 지정하게 될 예정입니다.

반환값:
프로토콜. 버젼 번호를 나타내는 「/version」가 뒤를 뒤따르는 일도 있는
관련 항목:
URL.getProtocol()

getRequestingPrompt

protected final String  getRequestingPrompt()
요구자가 입력한 prompt 캐릭터 라인을 가져옵니다.

반환값:
요구자가 입력한 prompt 캐릭터 라인 (http 요구를 위한 영역)

getRequestingScheme

protected final String  getRequestingScheme()
요구자가 사용하고 있는 방식 (예를 들어, HTTP 방화벽(fire wall)의 경우는 HTTP 방식)

반환값:
요구자가 사용하고 있는 방식

getPasswordAuthentication

protected PasswordAuthentication  getPasswordAuthentication()
패스워드 인증이 필요한 경우에 불려 갑니다. 서브 클래스에서는, 디폴트의 구현을 오버라이드(override) 할 필요가 있습니다. 디폴트의 구현에서는 null 가 돌려주어집니다.

반환값:
사용자로부터 수집한 PasswordAuthentication. 없는 경우에는 null

getRequestingURL

protected URL  getRequestingURL()
이 인증 요구의 결과인 URL 를 돌려줍니다.

반환값:
요구원의 URL
도입된 버젼:
1.5

getRequestorType

protected Authenticator.RequestorType  getRequestorType()
요구자가 프록시인가 서버인지를 돌려줍니다.

반환값:
요구자의 인증 타입
도입된 버젼:
1.5

JavaTM Platform
Standard Ed. 6

버그의 보고와 기능의 요청
한층 더 자세한 API 레퍼런스 및 개발자 문서에 대해서는,Java SE 개발자용 문서를 참조해 주세요. 개발자전용의 상세한 해설, 개념의 개요, 용어의 정의, 버그의 회피책, 및 코드 실례가 포함되어 있습니다.

Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy 도 참조해 주세요.