{"id":28112791,"url":"https://github.com/Yubico/java-u2flib-server","last_synced_at":"2025-05-14T05:05:00.982Z","repository":{"id":21934690,"uuid":"25259107","full_name":"Yubico/java-u2flib-server","owner":"Yubico","description":"(OBSOLETE) Java server-side library for U2F","archived":true,"fork":false,"pushed_at":"2022-07-06T15:31:04.000Z","size":920,"stargazers_count":130,"open_issues_count":0,"forks_count":57,"subscribers_count":58,"default_branch":"master","last_synced_at":"2024-01-30T09:55:14.322Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://developers.yubico.com/java-u2flib-server","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Yubico.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-15T14:46:41.000Z","updated_at":"2024-01-30T09:55:14.323Z","dependencies_parsed_at":"2022-09-08T00:12:27.648Z","dependency_job_id":null,"html_url":"https://github.com/Yubico/java-u2flib-server","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yubico%2Fjava-u2flib-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yubico%2Fjava-u2flib-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yubico%2Fjava-u2flib-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yubico%2Fjava-u2flib-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Yubico","download_url":"https://codeload.github.com/Yubico/java-u2flib-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254076849,"owners_count":22010611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-14T05:01:21.966Z","updated_at":"2025-05-14T05:05:00.976Z","avatar_url":"https://github.com/Yubico.png","language":"Java","funding_links":[],"categories":["安全"],"sub_categories":[],"readme":"== java-u2flib-server\n\nNOTE: _OBSOLETE: This project is no longer maintained.\nU2F has been superseded by https://www.w3.org/TR/webauthn/[Web Authentication],\nand this project is superseded by https://github.com/Yubico/java-webauthn-server/[java-webauthn-server].\nWe recommend using WebAuthn instead._\n\nimage:https://travis-ci.org/Yubico/java-u2flib-server.svg?branch=master[\"Build Status\", link=\"https://travis-ci.org/Yubico/java-u2flib-server\"]\nimage:https://coveralls.io/repos/github/Yubico/java-u2flib-server/badge.svg[\"Coverage Status\", link=\"https://coveralls.io/github/Yubico/java-u2flib-server\"]\n\nServer-side https://developers.yubico.com/U2F[U2F] library for Java. Provides functionality for registering\nU2F devices and authenticating with said devices.\n\n== Migrating to WebAuthn\n\nSee the https://github.com/Yubico/java-webauthn-server#migrating-from-u2f[Migrating from U2F] section\nin the https://github.com/Yubico/java-webauthn-server/[java-webauthn-server] documentation.\n\n=== Dependency\n\nMaven:\n[source, xml]\n \u003cdependency\u003e\n   \u003cgroupId\u003ecom.yubico\u003c/groupId\u003e\n   \u003cartifactId\u003eu2flib-server-core\u003c/artifactId\u003e\n   \u003cversion\u003e0.19.12\u003c/version\u003e\n \u003c/dependency\u003e\n\nGradle:\n[source, groovy]\n repositories{ mavenCentral() }\n dependencies {\n   compile 'com.yubico:u2flib-server-core:0.19.12'\n }\n\n=== Example Usage\nNOTE: Make sure that you have read https://developers.yubico.com/U2F/Libraries/Using_a_library.html[Using a U2F library] before continuing.\n\n[source, java]\n----\n\nprivate abstract Iterable\u003cDeviceRegistration\u003e getRegistrations(String username);\n\n@GET\npublic View startAuthentication(String username) throws NoEligibleDevicesException {\n\n    // Generate a challenge for each U2F device that this user has registered\n    SignRequestData requestData\n        = u2f.startSignature(SERVER_ADDRESS, getRegistrations(username));\n\n    // Store the challenges for future reference\n    requestStorage.put(requestData.getRequestId(), requestData.toJson());\n\n    // Return an HTML page containing the challenges\n    return new AuthenticationView(requestData.toJson(), username);\n}\n\n@POST\npublic String finishAuthentication(SignResponse response, String username) throws\n        DeviceCompromisedException {\n\n    // Get the challenges that we stored when starting the authentication\n    SignRequestData signRequest\n        = requestStorage.remove(response.getRequestId());\n\n    // Verify the that the given response is valid for one of the registered devices\n    u2f.finishSignature(signRequest,\n                             response,\n                             getRegistrations(username));\n\n    return \"Successfully authenticated!\";\n}\n----\n\nIn the above example `getRegistrations()` will return the U2F devices currently associated with a given user.\nThis is most likely stored in a database. \nSee link:u2flib-server-demo[`u2flib-server-demo`] for a complete demo server (including registration and storage of U2F devices).\n\n=== JavaDoc\nJavaDoc can be found at https://developers.yubico.com/java-u2flib-server[developers.yubico.com/java-u2flib-server].\n\n\n=== Attestation\nThe attestation module (`u2flib-server-attestation`) enables you to restrict registrations to certain U2F devices (e.g. devices made by a specific vendor). It can also provide metadata for devices.\n\n=== Serialization\nAll relevant classes implement `Serializable`, so instead of using `toJson()`, you can use Java's built in serialization mechanism.\nInternally the classes use Jackson to serialize to and from JSON, and the ObjectMapper from Jackson can be used.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FYubico%2Fjava-u2flib-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FYubico%2Fjava-u2flib-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FYubico%2Fjava-u2flib-server/lists"}