Gerviba / AuthSCH-java-api

Java API for auth.sch.bme.hu (oauth2)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AuthSch Java API

Coverage: 80.3% Version: 1.0.2 BEER-WARE

Usage

Getting started

  • You need to have an auth.sch account.
  • Register a new application.
  • Include the api to your project.
  • Make sure your project has the jackson-core and the jackson-databind dependency.

Spring boot applications will automatically include the jackson dependencies.

Initialize

    AuthSchAPI api = new AuthSchAPI();
    api.setClientIdentifier("20 digit number");
    api.setClientKey("80 chars key");

Store the api instance in application scope.

Generate url example

    api.generateLoginUrl(hashedSessionId, Scope.BASIC, Scope.GIVEN_NAME, Scope.MAIL));

You can also use a list of Scopes.

Validate code and get tokens

    AuthResponse auth = api.validateAuthentication(code);

Refresh the token

It will return a new AuthRespone instance.

    AuthResponse auth = api.refreshToken(refreshToken);

Get profile data

    ProfileDataResponse profile = api.getProfile(accessToken);

Maven

Compiled JAR

pom.xml

	<properties>
		<authsch.version>1.0.2</authsch.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-core</artifactId>
			<version>2.9.5</version>
		</dependency>
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-databind</artifactId>
			<version>2.9.5</version>
		</dependency>
		<dependency>
			<groupId>hu.sch</groupId>
			<artifactId>authsch</artifactId>
			<version>${authsch.version}</version>
			<scope>system</scope>
			<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/authsch-${authsch.version}.jar</systemPath>
		</dependency>
	</dependencies>

You might need to put the authsch-x.x.x.jar into the WEB-INF/lib folder.

List of projects

  • beugro.sch (Not released)

Submit your if you have.

License

"THE BEER-WARE LICENSE" (Revision 42):

<gerviba@gerviba.hu> wrote this file. As long as you retain this notice you
can do whatever you want with this stuff. If we meet some day, and you think
this stuff is worth it, you can buy me a beer in return. Szabó Gergely

About

Java API for auth.sch.bme.hu (oauth2)

License:Other


Languages

Language:Java 99.9%Language:Makefile 0.1%