8000 GitHub - subji/keycloak-settings · GitHub
[go: up one dir, main page]

Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

  1. keycloak 다운로드 ( https://www.keycloak.org/downloads )

  2. bin\standalone.sh -> 실행되는지 확인

  3. keycloak DB 설정 방법

    • jdbc 드라이버 다운 (.jar 파일로 다운)

    • .jar 위치를 modauls\system\layers\keycloak\org\DB명\main\ 넣기

    • 같은 위치에 modual.xml 추가

            <resources>
                <resource-root path="mariadb-java-client-2.6.1.jar"/>
            </resources>
      
            <dependencies>
                <module name="javax.api"/>
                <module name="javax.transaction.api"/>
            </dependencies>
        </module>
      
    • {home}\standalone\configuration\standalone.xml 설정
      ~ jdbc 드라이버 설정 ( 로 검색하면 밑에 있음 )

      org.mariadb.jdbc.MariaDbDataSource

      ~ datasource 설정 ( 로 검색하면 밑에 있음 ) ~ mariadb 또는 mysql 의 경우 utf8mb4 로 되어있는데 이거를 모두 utf8 로 변경해주어야 한다.

      {디비 주소} {jdbc 드라이버 설정에서 설정한 드라이버 명} 20 {DB 유저명} {DB 유저 비밀번호}

      ~ 기본 데이터 소스 설정 ( 로 검색하면 됨.)

  4. keycloak 재실행

여기까지가 기본적인 DB 연동

keycloak 어드민 설정 어드민 RESTApi 기본 주소 : http://localhost:8080/auth/admin/realms/{ realm명 }

  1. localhost:8080/ 으로 접속하면 초기 마스터 유저 생성

  2. http://localhost:8080/auth/admin/master/console/ 에서 마스터 유저로 로그인

  3. realm 생성 {서비스 명}-realm

  4. client 생성 {서비스 명}-{profile 명}

  5. client 세팅

    • Access Type : confidential로 변경
    • Service Accounts Enabled : on
    • credentials 탭에서 Secret , token 확인
  6. Roles 에서 role 추가

  7. 6번에서 생성한 role에서 composite Roles 를 on 밑에 생긴 client Roles 에서 realm-management 선택 후 view-users 추가

  8. Postman 에서 Oauth2.0 토큰 받아지는지 확인 ( http://localhost:8080/auth/realms/{ realm명 }/protocol/openid-connect/token )

  9. clients 탭에서 client 선택하고 Service Account Roles 에 6번에서 만든 role 추가

  10. Postman으로 API 확인 ( http://localhost:8080/auth/admin/realms/{ realm 명 }/users ) => 등록된 유저가 없으면 [] 이게 나옴

view-users : 이건 유저에 대한 정보 조회 manage-users : 이건 유저에 대한 모든 동작?

Module 추가, 실행 명령어


  • Module 추가
sh /mnt/d/subji/msa/msa-keycloak/keycloak-10.0.2/bin/jboss-cli.sh --command="module add --name={com.test.module.module-name} --resources={module .jar path} --dependencies=org.keycloak.keycloak-core,org.keycloak.keycloak-services,org.keycloak.keycloak-model-jpa,org.keycloak.keycloak-server-spi,org.keycloak.keycloak-server-spi-private,javax.ws.rs.api,javax.persistence.api,org.hibernate,org.javassist,org.liquibase"
  • 실행 명령어 (DB 및 로그 파일 위치 지정)
./bin/standalone.sh -Dkeycloak.profile.feature.account_api=enabled -Ddb.url="jdbc:mariadb://{db host}/{db name}?characterEncoding=UTF-8" -Ddb.user={db user} -Ddb.password={db password} -Dlogging.path={logging path not include '.log' file} -Dhandler.FILE.fileName={logging file name (with full path)} -b 0.0.0.0 &

한국어 설정


themes/bases/{각폴더}/messages/properties 로 관리(ja 거 복사)

회원가입에서 first name, last name 유효성 검사 제외하는 방법

참고

각 Identity Provider 및 SPI 모듈은 jar 파일을 이름을 맞추어 deployments 디렉토리 밑에 복사

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages

0