Java 애플리케이션 및 SDK 검사

이 솔루션 섹션에서는 다음 작업을 수행할 수 있습니다.

  • Java 웹 애플리케이션의 동작 및 코드 검사

  • Java 웹 애플리케이션이 Oracle Identity Cloud Service 시작 및 실패한 로그인 시도와 연관된 진단 데이터를 확인합니다.

Java 애플리케이션 동작 검사

Java 웹 응용 프로그램의 동작은 권한 부여 코드 권한 부여 유형으로 정의된 규정된 인증 플로우 3개를 따릅니다.

모든 요청, 응답 및 애플리케이션과 Oracle Identity Cloud Service 수행이 모두 수행되도록 브라우저 개발자 모드를 사용으로 설정합니다. 다음 예에서는 Google Chrome을 사용합니다.

  1. Java 웹 애플리케이션을 실행합니다.
  2. Google Chrome 웹 브라우저를 열고 http://localhost:8080 URL에 액세스하고 로그인 을 누릅니다.
  3. F12 을 누르고 네트워크 탭을 선택한 다음 로그 보존 체크 박스를 선택합니다.
    애플리케이션과 Oracle Identity Cloud Service 간의 모든 통신을 보려면 이 체크박스를 선택합니다.
  4. 로그인 페이지에서 빨간색 Oracle 아이콘을 누릅니다.

브라우저의 개발자 로그에는 다음 이벤트 흐름이 표시되어야 합니다.

  1. /auth/oracle 리소스를 요청하고 웹 브라우저가 Java 웹 애플리케이션에서 재지정 응답을 수신합니다.

    Request URL: http://localhost:8080/auth
    Request Method: GET
    Status Code: 302 Found
     
    Response Headers
    Location: https://idcs-abcd1234.identity.oraclecloud.com/oauth2/v1/authorize?client_id=123456789abcdefghij&redirect_uri= http%3A%2F%2Flocalhost%3A8080%2Fcallback&response_type=code&scope=urn:opc:idm:t.user.me+openid&state=1234
  2. Oracle Identity Cloud Service 권한 부여 코드 요청을 수신하고 사인인 페이지를 제공합니다.

    Request URL: https://idcs-abcd1234.identity.oraclecloud.com/oauth2/v1/authorize?client_id=123456789abcdefghij&redirect_uri= http%3A%2F%2Flocalhost%3A8080%2Fcallback&response_type=code&scope=urn:opc:idm:t.user.me+openid&state=1234
    Request Method: GET
    Status Code: 303 See Other
     
    Response Headers
    Location:
    https://idcs-abcd1234.identity.oraclecloud.com/ui/v1/signin
    Set-cookie: ORA_OCIS_REQ_1=[value has been omitted for readability]
  3. Oracle Identity Cloud Service 에 사인인하면 웹 브라우저가 Java 웹 애플리케이션의 콜백 URL로 재지정됩니다.

    Request URL:
    http://localhost:8080/callback?code=[value has been omitted for readability]&state=1234
    Request Method: GET
    Status Code: 200 OK
     
    Response Hearders
    Set-Cookie: JSESSIONID=[value has been omitted for readability]

이 예에서는 콜백 URL이 사용자 액세스 토큰 및 id 토큰을 세션 속성으로 설정한 상태에서 웹 브라우저를 페이지로 재지정합니다.

SDK 로그 검사

다음 단계에 따라 Oracle Identity Cloud Service Java SDK 로그를 설정하고 개발 중에 찾은 문제를 해결하십시오.

  1. ConnectionOptions.java 클래스 파일을 열고 getOptions() 메소드를 편집합니다.
  2. Constants.LOG_LEVEL 값을 DEBUG 로 설정합니다.

애플리케이션을 재작성하고 다시 실행하십시오.

다음과 같은 로그 세부정보가 표시됩니다.

Fine:   Got token manager
Fine:   using config endpoint: https://idcs-abcd1234.identity.oraclecloud.com:443/.well-known/idcs-configuration
...
Fine:   Got response content: [value has been omitted for readability]
...
Fine:   getAuthorizationCodeUrl returning with url: [value has been omitted for readability]
...
Fine:   authorizationCode with code: [value has been omitted for readability]
...
Fine:   Obtaining access token from: [value has been omitted for readability]
...
Fine:   returning access token
...
Fine:   Token signature verification result: true

진단 데이터를 확인하십시오.

Java 웹 애플리케이션이 Oracle Identity Cloud Service에 시작하는 성공과 실패한 로그 모두 Oracle Identity Cloud Service 진단 로그 파일에 등록됩니다.

  1. Oracle Identity Cloud Service 콘솔에 사인인합니다.
  2. 콘솔에서 탐색 전환기를 확장하고 설정 을 누른 다음 진단 을 누릅니다.
  3. 진단 유형으로 작업 뷰 를 선택하고 저장 을 누릅니다.
  4. Oracle Identity Cloud Service 에서 사인아웃합니다.

Oracle Identity Cloud Service - 다음 15 분에 대한 진단 데이터를 캡처합니다.

  1. Java 응용 프로그램 실행 항목의 단계를 완료하여 Java 웹 응용 프로그램의 로그인 페이지를 표시합니다.

  2. 빨간색 Oracle 아이콘을 누릅니다.

  3. 사인인 시도를 실패하면 Oracle Identity Cloud Service 사인인 페이지에 잘못된 사용자 이름 또는 비밀번호를 입력합니다.

  4. 성공적으로 사인인하려면 올바른 사용자 이름 및 비밀번호를 입력하십시오.

  5. Java 웹 애플리케이션을 사용하여 Oracle Identity Cloud Service 에서 사인아웃합니다.

  6. Oracle Identity Cloud Service 콘솔에 다시 사인인합니다.

  7. 콘솔에서 탐색 전환기를 확장하고 보고서 를 누른 다음 진단 데이터 를 누릅니다.

  8. 시간 범위의 경우 15-Minute, 로그 유형에 대한 작업 뷰 , 보고서 형식에 대한 CSV 순으로 선택하고 보고서 다운로드 를 누릅니다.

진단 로그 파일에는 Oracle Identity Cloud Service 사인인에 사용되는 사용자에 대한 다음과 같은 정보가 포함됩니다.

Message: ID Token will be signed with User Tenant:idcs-abcd1234 Resource Tenant:idcs-abcd1234, clientId=123456789abcdefghij
Component: OAuth
Timestamp: [Date]
Actor ID: your.email@example.com
---------------------------------------------------------------
...
---------------------------------------------------------------
Message: {"request":{"tenant":"idcs-abcd1234","grant types":"authorization_code","scopes":["urn:opc:idm:t.user.me"]},"user":{"id":"111111","name":"your.email@example.com","tenant":"idcs-abcd1234","auth-type":"PASSWORD"},"client":{"id":"123456789abcdefghij","name":"Sample App","tenant":"idcs-abcd1234","auth-type":"PASSWORD"},"environment":{"isCSR":"false","onBehalfOfUser":"false"},"response":{"result":"ALLOWED","scopes":["urn:opc:idm:t.user.me"],"custom-claims":{"clientAppRoles":["Authenticated Client","Me"],"userAppRoles":["Authenticated","Global Viewer","Identity Domain Administrator"],"user_isAdmin":"true"}}}
Component: Authorization/getAllowedScopes
Timestamp: [Date]
Actor ID: your.email@example.com
---------------------------------------------------------------
...
---------------------------------------------------------------
Message: {"Message":"SSO SignOn Policy evaluation result for user : 11111  is : effect:ALLOW,authenticationFactor:IDP,allowUserToSkip2FAEnrolment:false,2FAFrequency:SESSION,reAuthenticate:false,trustedDevice2FAFrequency:
Component:
Timestamp:
Actor ID:
---------------------------------------------------------------
...
---------------------------------------------------------------
Message: [PolicyEngineUtil.evaluatePolicy] Evaluating Default Sign-On Policy
Component: PolicyEngine
Timestamp: [Date]
Actor ID: uiSignin
---------------------------------------------------------------
...
---------------------------------------------------------------
Message: [PolicyEngineUtil.evaluateRule] Evaluating MFA rule
Component: PolicyEngine
Timestamp: [Date]
Actor ID: uiSignin
---------------------------------------------------------------
...
---------------------------------------------------------------
Message: [PolicyEngineUtil.evaluatePolicy] Evaluating Default Authentication Target App Policy
Component: PolicyEngine
Timestamp: [Date]
Actor ID: idcssso
---------------------------------------------------------------
...
---------------------------------------------------------------
Message: {"password":"********","authFactor":"USERNAME_PASSWORD","device":"{\"currentTime\":\"[date]",\"screenWidth\":1920,\"screenHeight\":1080,\"screenColorDepth\":24,\"screenPixelDepth\":24,\"windowPixelRatio\":1,\"language\":\"en\",\"userAgent\":\"Mozilla\/5.0 (Windows NT 10.0
Component:
Timestamp:
Actor ID:
---------------------------------------------------------------
...
---------------------------------------------------------------
Message: {"Message":"No session found so need to collect credentials","Redirecting to Login URL: ":https://idcs-abcd1234.identity.oraclecloud.com/ui/v1/signin}
Component: SSO
Timestamp: [Date]
Actor ID: Unauthenticated
---------------------------------------------------------------
...
---------------------------------------------------------------
 
Message: [PolicyEngineUtil.evaluatePolicy] Evaluating Default Identity Provider Policy
Component: PolicyEngine
Timestamp: [Date]
Actor ID: Unauthenticated
---------------------------------------------------------------
Message: Authorization Request, received parameters: scope[urn:opc:idm:t.user.me openid] response_type[code] state[1234] redirect_uri[http://localhost:8080/callback] client_id[123456789abcdefghij]
Component: OAuth
Timestamp: [Date]
Actor ID: Unauthenticated

가장 최근 로그가 파일 상단에 나타납니다.