Skip to content
Snippets Groups Projects
Select Git revision
  • 4bc1d5e521e337e16171709d107ec910f6c1162e
  • master default protected
2 results

AuthSCH-Java-Client

gerviba's avatar
Szabó Gergely authored
4bc1d5e5
History
Name Last commit Last update
src
.gitignore
LICENSE
Makefile
README.md
pom.xml

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