상명대학교 학생 인증 라이브러리
- 상명대학교 학생 여부를 간편하게 확인하는 라이브러리입니다.
- 학생 인증 방식은 상명대학교 포털 SSO 인증 방식입니다.
implementation 'kr.co.smunity:sangmyung-univ-auth:1.0.5'<dependency>
<groupId>kr.co.smunity</groupId>
<artifactId>sangmyung-univ-auth</artifactId>
<version>1.0.5</version>
</dependency>import com.smunity.AuthManager;
import com.smunity.dto.AuthResponseDto;
import com.smunity.exception.AuthException;
public class AuthExample {
public static void main(String[] args) {
try {
// 학번과 비밀번호로 인증
String username = "201911019";
String password = "your_password";
// 인증 실행
AuthResponseDto responseDto = AuthManager.authenticate(username, password);
// 인증 성공: AuthResponseDto[username=201911019, name=최현민, [email protected], department=컴퓨터과학전공, secondDepartment=null]
System.out.println("인증 성공: " + responseDto);
} catch (AuthException e) {
// 인증 실패: Username and password do not match.
System.out.println("인증 실패: " + e.getMessage());
}
}
}-
Request
- URL
https://smunity.co.kr/api/v1/auth - Method
POST - Body
{ "username": "<학번>", "password": "<비밀번호>" }
- URL
-
Response
- Success:
200 OK{ "username": "201911019", "name": "최현민", "email": "[email protected]", "department": "컴퓨터과학전공", "secondDepartment": null } - Fail:
401 Unauthorized{ "code": "AUTH001", "message": "학번 및 비밀번호가 일치하지 않습니다." }
- Success: