Class YggdrasilMinecraftSessionService
java.lang.Object
com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService
- All Implemented Interfaces:
MinecraftSessionService
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate final URLprivate final MinecraftClientprivate final com.google.gson.Gsonprivate final com.google.common.cache.LoadingCache<UUID, Optional<ProfileResult>> private final URLprivate static final org.slf4j.Loggerprivate final ServicesKeySet -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedYggdrasilMinecraftSessionService(ServicesKeySet servicesKeySet, Proxy proxy, Environment env) -
Method Summary
Modifier and TypeMethodDescriptionprivate static Set<ProfileActionType> extractProfileActionTypes(Set<ProfileAction> response) fetchProfile(UUID profileId, boolean requireSecure) Fetches the profile information associated with the given ID from the session service.private ProfileResultfetchProfileUncached(UUID profileId, boolean requireSecure) getPackedTextures(GameProfile profile) Gets the packed property representation of any textures contained in the given profile.private SignatureStategetPropertySignatureState(Property property) getSecurePropertyValue(Property property) Verifies the signature and returns the value of aProperty.hasJoinedServer(String profileName, String serverId, InetAddress address) Checks if the specified user has joined a Minecraft server.voidjoinServer(UUID profileId, String authenticationToken, String serverId) Attempts to join the specified Minecraft server.unpackTextures(Property packedTextures) Unpacks the texture data contained in the given packed profile property.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface MinecraftSessionService
getTextures
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
client
-
servicesKeySet
-
baseUrl
-
joinUrl
-
checkUrl
-
gson
private final com.google.gson.Gson gson -
insecureProfiles
-
-
Constructor Details
-
YggdrasilMinecraftSessionService
protected YggdrasilMinecraftSessionService(ServicesKeySet servicesKeySet, Proxy proxy, Environment env)
-
-
Method Details
-
joinServer
public void joinServer(UUID profileId, String authenticationToken, String serverId) throws AuthenticationException Description copied from interface:MinecraftSessionServiceAttempts to join the specified Minecraft server. If this method returns without throwing an exception, the join was successful and a subsequent call toMinecraftSessionService.hasJoinedServer(String, String, InetAddress)will return true.- Specified by:
joinServerin interfaceMinecraftSessionService- Parameters:
profileId- The player profile ID to join asauthenticationToken- The authenticated token of the userserverId- The random ID of the server to join- Throws:
AuthenticationException- Generic exception indicating that we could not authenticate the user
-
hasJoinedServer
@Nullable public ProfileResult hasJoinedServer(String profileName, String serverId, @Nullable InetAddress address) throws AuthenticationUnavailableException Description copied from interface:MinecraftSessionServiceChecks if the specified user has joined a Minecraft server.- Specified by:
hasJoinedServerin interfaceMinecraftSessionService- Parameters:
profileName- The player name to check forserverId- The random ID of the server to check foraddress- The address connected from- Returns:
- Full game profile if the user had joined, otherwise null
- Throws:
AuthenticationUnavailableException- Thrown when the servers return a malformed response, or are otherwise unavailable
-
getPackedTextures
Description copied from interface:MinecraftSessionServiceGets the packed property representation of any textures contained in the given profile.- Specified by:
getPackedTexturesin interfaceMinecraftSessionService- Parameters:
profile- the profile to get textures from- Returns:
- the packed property containing texture data, or
nullif this profile does not have any - See Also:
-
unpackTextures
Description copied from interface:MinecraftSessionServiceUnpacks the texture data contained in the given packed profile property.- Specified by:
unpackTexturesin interfaceMinecraftSessionService- Parameters:
packedTextures- the raw texture data to unpack- Returns:
- the unpacked set of textures, or
MinecraftProfileTextures.EMPTYif the data was malformed - See Also:
-
fetchProfile
Description copied from interface:MinecraftSessionServiceFetches the profile information associated with the given ID from the session service. This will include all properties associated with the profile. The profile must have an ID. If no information is found, nothing will be done.- Specified by:
fetchProfilein interfaceMinecraftSessionService- Parameters:
profileId- The ID of the game profile to request.requireSecure- If the profile property map should include verifiable signature information.- Returns:
- Fetched profile for the requested user, or
nullif unsuccessful or the user did not exist.
-
getSecurePropertyValue
Description copied from interface:MinecraftSessionServiceVerifies the signature and returns the value of aProperty.- Specified by:
getSecurePropertyValuein interfaceMinecraftSessionService- Parameters:
property- Property to return the value of.- Returns:
- String value
- Throws:
InsecurePublicKeyException- If data is insecure or missing
-
getPropertySignatureState
-
fetchProfileUncached
-
extractProfileActionTypes
-