-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
608 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/gradlew text eol=lf | ||
*.bat text eol=crlf | ||
*.jar binary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
HELP.md | ||
.gradle | ||
build/ | ||
!gradle/wrapper/gradle-wrapper.jar | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
bin/ | ||
!**/src/main/**/bin/ | ||
!**/src/test/**/bin/ | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
|
||
### VS Code ### | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
# SejongAuth | ||
|
||
SejongAuth는 세종대학교 통합 로그인 페이지에 접근하여 사용자 인증과 프로필 정보를 가져오는 Java 기반의 패키지입니다. `Sj`를 통해 세종대학교 포털에 간편하게 로그인하고 사용자의 학적 정보를 조회할 수 있습니다. | ||
|
||
## 주요 기능 | ||
|
||
- **로그인 기능**: `LoginReq`를 사용하여 세종대학교 포털에 로그인하고 `JSESSIONID`를 획득합니다. | ||
- **프로필 조회 기능**: 로그인 성공 시 `ProfileService`를 통해 사용자의 학적 정보를 가져옵니다. | ||
|
||
--- | ||
|
||
## 설치 방법 | ||
|
||
gradle | ||
```properties | ||
dependencyResolutionManagement { | ||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) | ||
repositories { | ||
mavenCentral() | ||
maven { url 'https://jitpack.io' } | ||
} | ||
} | ||
dependencies { | ||
implementation 'com.github.urinaner:sejong-auth:Tag' | ||
} | ||
``` | ||
maven | ||
```yaml | ||
<repositories> | ||
<repository> | ||
<id>jitpack.io</id> | ||
<url>https://jitpack.io</url> | ||
</repository> | ||
</repositories> | ||
|
||
<dependency> | ||
<groupId>com.github.urinaner</groupId> | ||
<artifactId>sejong-auth</artifactId> | ||
<version>Tag</version> | ||
</dependency> | ||
``` | ||
|
||
|
||
--- | ||
|
||
## 프로젝트 구조 | ||
|
||
``` | ||
SejongAuth/ | ||
├── src/ | ||
│ ├── main/ | ||
│ │ ├── java/org/yj/sejongauth/controller/Sj.java | ||
│ │ ├── java/org/yj/sejongauth/domain/AuthService.java | ||
│ │ ├── java/org/yj/sejongauth/domain/LoginReq.java | ||
│ │ ├── java/org/yj/sejongauth/domain/ProfileRes.java | ||
│ │ └── java/org/yj/sejongauth/domain/ProfileService.java | ||
│ └── test/ | ||
│ └── java/org/yj/sejongauth/controller/AuthControllerTest.java | ||
└── build.gradle | ||
``` | ||
|
||
--- | ||
|
||
## 사용법 | ||
|
||
### 1. `LoginRequestDto` 생성 | ||
|
||
로그인 요청 객체를 생성합니다. | ||
|
||
```java | ||
LoginRequestDto loginRequestDto = new LoginRequestDto("userId", "password"); | ||
``` | ||
|
||
### 2. 로그인 및 프로필 조회 | ||
|
||
`Sj.login()` 메서드를 사용하여 로그인 및 프로필 정보를 조회할 수 있습니다. | ||
|
||
```java | ||
ProfileRes profile = Sj.login(loginReq); | ||
System.out.println("User profile: " + profile); | ||
``` | ||
|
||
--- | ||
|
||
## 예제 | ||
|
||
아래는 `Sj.login` 메서드를 호출하여 간단히 로그인과 프로필 조회를 수행하는 예제입니다. | ||
|
||
```java | ||
|
||
public class Main { | ||
public static void main(String[] args) { | ||
LoginReq loginReq = new LoginReq("testUser", "testPassword"); | ||
|
||
try { | ||
ProfileRes profile = Sj.login(loginReq); | ||
System.out.println("Login successful. User profile: " + profile); | ||
} catch (RuntimeException e) { | ||
System.err.println("Login failed: " + e.getMessage()); | ||
} | ||
} | ||
} | ||
``` | ||
|
||
--- | ||
|
||
## 테스트 | ||
|
||
`AuthService` 클래스에서 로그인에 대한 테스트를 실행할 수 있습니다. | ||
|
||
|
||
--- | ||
|
||
## 주의사항 | ||
|
||
- **네트워크 연결**: 이 프로그램은 네트워크 연결이 필요합니다. | ||
- **예외 처리**: 네트워크 오류, 로그인 실패 등의 상황에서 `RuntimeException`이 발생할 수 있습니다. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
plugins { | ||
id 'java' | ||
id 'org.springframework.boot' version '3.3.5' apply(false) | ||
id 'io.spring.dependency-management' version '1.1.6' | ||
id 'maven-publish' | ||
} | ||
|
||
group = 'org.yj' | ||
version = '0.0.1-SNAPSHOT' | ||
|
||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(21) | ||
} | ||
} | ||
|
||
configurations { | ||
compileOnly { | ||
extendsFrom annotationProcessor | ||
} | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
maven { url "https://jitpack.io" } | ||
} | ||
|
||
dependencyManagement { | ||
imports { | ||
mavenBom org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation 'org.springframework.boot:spring-boot-starter-web:3.1.2' | ||
implementation 'org.jsoup:jsoup:1.14.3' | ||
compileOnly 'org.projectlombok:lombok:1.18.26' | ||
annotationProcessor 'org.projectlombok:lombok:1.18.26' | ||
testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher' | ||
} | ||
|
||
publishing { | ||
publications { | ||
maven(MavenPublication) { | ||
groupId = 'com.example.coreservice' | ||
artifactId = 'core-service' | ||
version = '0.2.4' | ||
|
||
from components.java | ||
} | ||
} | ||
} | ||
tasks.named('test') { | ||
useJUnitPlatform() | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.