Poco::OSP::Web

class TokenValidator

File Information

Library: OSP/Web
Package: Web
Header: Poco/OSP/Web/TokenValidator.h

Description

TokenValidator is an optional service that is used by the WebServerDispatcher to validate bearer tokens and obtain the associated user name.

Inheritance

Direct Base Classes: Poco::OSP::Service

All Base Classes: Poco::OSP::Service, Poco::RefCountedObject

Member Summary

Member Functions: isA, type, validateToken

Inherited Functions: duplicate, isA, referenceCount, release, type

Types Aliases

Ptr

using Ptr = Poco::AutoPtr < TokenValidator >;

Member Functions

isA virtual

bool isA(
    const std::type_info & otherType
) const;

type virtual

const std::type_info & type() const;

validateToken virtual

virtual bool validateToken(
    const std::string & token,
    std::string & username,
    std::string & scope
) = 0;

Validates the given bearer token.

If valid, returns true and the associated username and scope. If invalid, returns false, leaving the username and scope unchanged.

The format of the token (e.g., JWT) and method of validation is left to the implementation.

Securely control IoT edge devices from anywhere   Connect a Device